Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can i append(not write) the query result to spool file? 1

Status
Not open for further replies.

beksalur

Technical User
Jan 2, 2003
74
TR
can i append(not write) the query result to spool file?whenever i run the sql it over writes on the old file(not appending to end of output file) so that my old statistics have lost.

Thanks in advance.
 
You may call sqlplus with -s (silent) option and redirect screen output into file using append mode rather than spoolong to that file:

sqlplus -s scott/tiger @script.sql >> results.txt



Regards, Dima
 
If on UNIX - you can move (rename) the file before you overwrite it - I don't think there is a way to append

SQL> !mv file.lst file.lst.old
SQL> spool file
SQL> select * from table;

<results>

SQL> spool off

Alex
 
or use a host cat command to append the new spool to the log

SQL> spool off
SQL> !cat file.lst >> log.file


Alex
 
Beksalur,

When I wish to append SELECTed output to a flat file, I use PL/SQL's utl_file mechanism, opening the target flat file with the 'append' ('A') parameter instead of 'write' ('W').

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top