Home » SQL & PL/SQL » SQL & PL/SQL » Spool only SQL query result
Spool only SQL query result [message #226542] Sat, 24 March 2007 20:09 Go to next message
mgole001
Messages: 3
Registered: March 2007
Junior Member
Hi all,

I want to spool the result of a SQL query to a file through sqlplus. I want to only spool the result and the heading to the file and not the query. Is this possible?

Eg
SQL> spool off;
SQL> set echo off
SQL> set heading on
SQL> set feedback off
SQL> set termout off
SQL> spool test.out
SQL> select sysdate from dual;

SYSDATE
---------
24-MAR-07
SQL> spool off;


I want the spool file to only contain the result

SYSDATE
---------
24-MAR-07


but my spool file contains

SQL> select sysdate from dual;

SYSDATE
---------
24-MAR-
07
SQL> spool off;


Thanks
Re: Spool only SQL query result [message #226543 is a reply to message #226542] Sat, 24 March 2007 20:38 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
SQL > SET TERM OFF ECHO OFF
Re: Spool only SQL query result [message #226563 is a reply to message #226542] Sun, 25 March 2007 02:35 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You have to put the statements in a file (including the spool one) and execute the file.
If you interactively type the statements then there will be in the spool file.

Regards
Michel
Previous Topic: Number of Bind variables passed AND Ref Cursor problem
Next Topic: how to create view using stored procs
Goto Forum:
  


Current Time: Sat Dec 10 22:49:17 CST 2016

Total time taken to generate the page: 0.08720 seconds