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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Spool File with Just One Line 1

Status
Not open for further replies.

tekdudedude

Technical User
Sep 29, 2007
79
Hey All,

I am trying to create a spool file that only contains one line (the line of my output value). I am using the following set commands and SQL:

Code:
set feedback off 
set heading off
set pagesize 0
set term off
set trimspool on
spool myfile.spool
SELECT select sysdate from dual;
spool off

This outputs two lines. First line is the expected date and the second line is blank.

Using just SQLPlus, how can I create a spool file with one just one line output?

Thanks,

TD
 
I would be quite surprised if that works, because you've got select twice.

The following works on my system and produces only one line:

set feedback off
set heading off
set pagesize 0
set term off
set trimspool on
spool myfile.spool
SELECT sysdate from dual;
spool off
exit

However, it may depend on your version of Oracle and the OS you're running on. I'm running 9.2.0.4.0 on Solaris.

 
Dagon,

Thanks for posting - that did it. I think my set commands were inccorect.

TD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top