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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.