Oralce's Save command
You can use the save () command to save the content of the current buffer to a file. In this way, even if the content in the buffer is overwritten, the syntax of the save command for executing the current statement is retained as follows:
Save [file] file_name [replace | create | append]
File_name indicates that the content of the SQL * PLUS buffer is saved to a file specified by file_name, and create indicates that a file_name file is created and the content in the buffer is saved to the file, this option is the default value. Replace indicates that if file_name already exists, the content of the file_name file will be overwritten; if the file does not exist, the file will be created. Append: If the file_name file already exists, the content in the buffer is appended to the content of the file_name file. If the file does not exist, the file is created.
The specific operations are as follows:
SQL> select * from dept;
DEPTNO DNAME LOC
-------------------------------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> save query. SQL
File query has been created. in SQL, a query is found under my D: \ Oracle \ app \ Administrator \ product \ 12.1.0 \ dbhome_1 \ BIN. SQL file with the following content:
Select * from dept
/
If you want to save the result to another place, you can specify the path when creating the result, for example, save e: \ query. the SQL statement is saved in the directory of the E disk. You can also use savee: \ query. SQL replace;
Or save e: \ query. SQL append, which is not described here.