Merve Olamlı

SPOOL COMMAND

Posted by merveolamli on September 12, 2007

‘spool … ’ command is used to send queries and their results to a file. This can be said, it is like a screen shot format of the commands to the file. You have to spool on and spool off between which executions to store. But there are two different output files when spooling in different editors, for sqlplus command line and for pl/sql developer. After connecting to the database:

* In sqlplus command line:

SQL> spool on
SQL> spool c:\spool_here.txt
SQL> select count(*) from user_objects;
COUNT(*)
———-
71

SQL> spool off

–The output in the spool_here.txt file is:

SQL> select count(*) from user_objects;
COUNT(*)
———-
71

SQL> spool off


* In pl/sql developer command window:

SQL> spool c:\spool_here.txt
Started spooling to c:\spool_here.txt

SQL> select count(*) from user_objects;
COUNT(*)
———-
71

SQL> spool off
Stopped spooling to c:\spool_here.txt

–The output in the spool_here.txt file is:

COUNT(*)
———-
71

According to this test situation, it can be said that, pl/sql developer only takes the outputs of the queries while sqlplus command window takes all the written queries and their outputs.
In addition to this, you cannot see any output in the output files until ‘spool off ’ command executes.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>