As explained earlier in the module, the SQL buffer is overwritten with every new SQL command you enter in SQL*Plus. If you want to save the contents of the SQL buffer,
you can use the SQL*Plus SAVE command. The SAVE command creates a script file containing the contents of the SQL buffer.
PMT Process modeling techniques DSG 1
RSD Relational system design DSG 2
PRO Prototyping DSG 5
GEN System generation DSG 4
10 rows selected.
SQL> save result1
SP2-0540: File "result1.sql" already exists.
Use "SAVE filename[.ext] REPLACE".
SQL> save result1 replace
Created file result1.sql
SQL>
Note the error message after the second SAVE RESULT1 attempt; REPLACE (or APPEND) is mandatory if a file already exists.
Since the SQL buffer is overwritten with each new SQL command issued, using the SAVE APPEND syntax when creating a script file can be useful if you would like any new SQL
commands you issue to be added to your script file. We have created two script files.
These script files are assigned the extension .SQL by default.
If you prefer to use a different file name extension, you can change it with the SQL*Plus SUFFIX setting.