I want to know about spooling procedure or concept in SQL.I want to write records into sql file so some tips on spooling procedures and commands would help me to achieve the concept.
Printable View
I want to know about spooling procedure or concept in SQL.I want to write records into sql file so some tips on spooling procedures and commands would help me to achieve the concept.
SPOOL is a SQL*Plus command which helps to write into a file.
If the extension is not given, then the file extension will be .lst
The command, "SPOOL IN" in SQL prompt will create a file IN.lst & will be in open state till the command "SPOOL OFF".
Instead of IN, if the file name with extension is given like "SPOOL testfile.sql", then the file testfile.sql will be create.
The command "SPOOL OUT" will print the file which has been generated.
*** Mangai Varma ***
eg:
spool file
select * from my_table
spool off
All Output records will come to ur file
One more thing, I wud like to add here...
It is common concern to remove the heading of columns while generating the extract using spool command... it was a real scenario in my project...
to remove the heading, we can use-
set head off
spool &p_spool_file
select * from emp;
spool off;
set head on