Practical application of Oracle sqlplus to format data

Source: Internet
Author: User

The following articles mainly describe the practical application of Oracle sqlplus data formatting. We all know that spool is useful in practical applications, however, it is not familiar with the set command on the formatted data, so I found it online and noted it below:

 
 
  1. SQL>set colsep' ';  

Domain output Separator

 
 
  1. SQL>set newp none  

Set the number of pages to display the queried data. If continuous data is required, set newp to none if there are no blank rows in the middle, so that the output data rows are continuous, there are no blank lines in the middle.

 
 
  1. SQL>set echo off;  

Displays each SQL command in the start script. The default value is on.

 
 
  1. SQL> set echo on 

Set whether to display the statement when running the command.

 
 
  1. SQL> set feedback on; 

Set to display "XX rows selected"

 
 
  1. SQL>set feedback off;   

Display the number of records processed by this SQL command. By default, on is used to remove the last "10000 rows selected"

 
 
  1. SQL>set heading off;  

Output field title. The field name of the select result is removed when the on field is set to off by default. Only the formatted data of Oracle sqlplus is displayed.

 
 
  1. SQL>set pagesize 0;  

The number of output lines per page. The default value is 24. To avoid paging, you can set the value to 0.

 
 
  1. SQL>set linesize 80;  

Output the number of characters in a row. The default value is 80.

 
 
  1. SQL>set numwidth 12;  

Length of the output number field. The default value is 10.

 
 
  1. SQL>set termout off; 

Displays the execution results of commands in the script. The default value is on.

 
 
  1. SQL>set trimout on;  

Removes trailing spaces of each standard output line. The default value is off.

 
 
  1. SQL>set trimspool on; 

Remove redirection spool) the trailing space of each row is output. The default value is off.

 
 
  1. SQL>set serveroutput on; 

Set to allow display of output similar to dbms_output

 
 
  1. SQL> set timing on; 

Set to display "used time: XXXX"

 
 
  1. SQL> set autotrace on-; 

Set to allow analysis of executed SQL statements

 
 
  1. set verify off 

You can disable or enable the display of the message "old 1" and "new 1.

Oracle export data to a file:

Sqlplus/nolog @ d: \ sp. SQL

D: \ sp. SQL:

 
 
  1. set head off  
  2. set headsep off  
  3. set newp none  
  4. set linesize 100  
  5. set pagesize 10000  
  6. set sqlblanklines OFF  
  7. set trimspool ON  
  8. set termout off  
  9. set feedback off  
  10. spool d:\export.txt  
  11. select NODECODE||'&'||NODETYPE||'&'||NODENAME||'&' from "000".tbnode;  
  12. spool off  
  13. exit   

The above content is an introduction to Oracle sqlplus formatting data. I hope you will find some gains.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.