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

spool question 2

Status
Not open for further replies.

oracleSQLdba

IS-IT--Management
Nov 2, 2006
53
US
I want to spool my results without the SQL> in my results:

SQL> col1, col2, col3 etc.

How can I get rid of the SQL> in the spool output?

 
not sure if this helps:
You could get rid of the SQL> in the screen ouput in first place, by typing this in SQL*plus:
set sqlprompt
 
OracleSQLDBA,

Here is a proof of concept for how to obtain just the output you want...I created a script call "tt_400.sql" that contains the following:
Code:
set echo off
spool temp.txt
select * from s_region;
spool off
When I run the code, this is what I receive
Code:
SQL> @tt_400

        ID NAME
---------- -------------------------
         1 North America
         2 South America
         3 Africa / Middle East
         4 Asia
         5 Europe

SQL> get temp.txt
  1          ID NAME
  2  ---------- --------------------
  3           1 North America
  4           2 South America
  5           3 Africa / Middle East
  6           4 Asia
  7*          5 Europe
Notice that when I "get" the output, there is no "SQL>" or other unwanted text.

Let us know if this resolves your neet.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
That's all great. How can I get rid off the "spool off" at the end of the file??
 
Generally to get rid of extraneous output in SQL scripts I use the following:-

set echo off
set validate off
set termout off
set feedback off

 
OracleSQLDBA,

If you are seeing "spool off" at the end of the spooled file, then you are either a) not running the code from a script or b) lacking the "set echo off" command...Notice that I have a "spool off" command in my script, but "spool off" did not appear in the spooled file, which I displayed for you (with no modifications) in my post, above.

Please let us know your findings.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top