amphibient
amphibient

Reputation: 31212

Get SQL*Plus out in a file w/out "SQL>" line prefixes

I am trying to get SQL*Plus to write progress in its out file that should be somewhat presentable as a report, i.e. not have undesirable formatting native to the application. In particular, I would like to get rid of SQL> that every line seems to start with. This is my shell script that invokes sqlplus:

#!/usr/bin/ksh

$ORABIN/sqlplus $ORADBUSER/$ORADBPASSWD@$ORADB<<!!>./orclTest.log

SELECT 'IN sqlplus' AS MESSAGE1 FROM dual;


VARIABLE rowCnt number;
BEGIN
SELECT COUNT(*) INTO :rowCnt FROM dual;
END;
/

SELECT 'Dual has ' || :rowCnt || ' rows' AS MESSAGE2 FROM  dual;


!!

When I run it, this is what I get in orclTest.log:

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Oct 22 18:06:02 2012

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> SQL>
MESSAGE1 
----------
IN sqlplus

SQL> SQL> SQL> SQL>   2    3    4
PL/SQL procedure successfully completed.

SQL> SQL>
MESSAGE2
------------------------------------------------------
Dual has 1 rows

Any way to tell sqlplus not to give me its standard formatting, like the header and prefixes and only output:

MESSAGE1 
----------
IN sqlplus


MESSAGE2
------------------------------------------------------
Dual has 1 rows

Upvotes: 0

Views: 2759

Answers (1)

Justin Cave
Justin Cave

Reputation: 231651

If you want to omit the SQL> prompt

 set sqlprompt ''

If you want to remove the numbers that are printed to denote subsequent lines in a multi-line statement

set sqlnumber off

Upvotes: 3

Related Questions