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!

Does SQL PLUS HEADING apply to spooled output? 1

Status
Not open for further replies.

weberm

Programmer
Dec 23, 2002
240
US
I am writing a script file for SQL*PLUS which spools output to a file but I noticed it does not include the headers, even when I set the HEADING on:

Code:
-- set output to a file
SPOOL RCPI_RUN_ALL.LOG

SET ECHO ON
SET LINESIZE 500
SET PAGESIZE 0
SET SERVEROUTPUT ON SIZE 1000000
SET SCAN OFF
SET FEEDBACK ON
SET TERMOUT ON
SET TAB OFF
SET HEADING on

-- ============================================================
-- Verify that this script is running in the right instance
-- ============================================================
SELECT * FROM whoami;

Running this script, for example, results in this log file:
SQL> SET LINESIZE 500
SQL> SET PAGESIZE 0
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL> SET SCAN OFF
SQL> SET FEEDBACK ON
SQL> SET TERMOUT ON
SQL> SET TAB OFF
SQL> SET HEADING on
SQL>
SQL> -- ============================================================
SQL> -- Verify that this script is running in the right instance
SQL> -- ============================================================
SQL> SELECT * FROM whoami;
DEV6 RCPI 09-12-2008 13:32:35

1 row selected.
However, when I run it within SQL*PLUS, I get the following:
SQL> SELECT * FROM whoami;

INSTANCE LOGGED_ON_AS DATE_TIME
---------------- --------------- -------------------
DEV6 RCPI 09-12-2008 13:34:04
Does anyone see why it does not appear this way in my spooled file?
 

The following will suppress headings:

SET PAGESIZE 0

[3eyes]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Despite the brevity of LK's excellent solution, it deserves a
star.gif
, right?

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm. The cost will be your freedoms and your liberty.”
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top