Lesson 5 | Working with Files |
Objective | Save a query to a file, replace a file, and edit a file. |
>Command | Description |
GET filename[.ext] [LIS[T]|NOL[IST]] |
Put the contents of filename into the SQL*Plus buffer. If no parameter is used, the contents is listed. You can specify NOLIST to prevent listing the contents when it is loaded. Default for .ext is .sql. |
REM[ARK] text Or -- text Or /* text */ |
Add a remark into a file. REM marks an entire line as a comment. “--” marks everything from that point to the end of the line as a comment (useful for comments on the same line as a short command.) The last option allows you to place multiple lines between the beginning and ending marks (useful for documentation). |
RUN filename[.ext] |
Execute the SQL command in filename. Use RUN only when there is a single SQL command in the file and no SQL*Plus commands (such as COLUMN or
TTITLE ). If the file contains multiple commands or contains SQL*Plus commands, use the START command to execute the file.
|
SAV[E] filename[.ext] [CRE[ATE]|REP[LACE] |APP[END]] |
Write the SQL*Plus buffer to filename. If no parameter is used, the file is created. |
STA[RT] filename[.ext] Or @filename[.ext] Or @@filename[.ext] |
Executes the commands in filename inside SQL*Plus. The last command is stored in the buffer. |
SQL> L 1 select * 2* from employees SQL>