shubham deodia
shubham deodia

Reputation: 189

Prevent Spool to add SQL query in output file

I want my script to stop printing the SQL query in the output file.

I have tried different method, but its just not happening.

sqlplus user/password@(TNS Entry) << EOF
SET head OFF;
SET feed OFF;
SET trimspool ON;
SET linesize 32767;
SET pagesize 32767;
SET echo OFF;
SET termout OFF;
SET verify OFF;
SET NEWPAGE NONE;
SET verify off;
@test.txt
spool file_name.csv
select * from Customer;
spool off

EXIT;
EOF

Could you help please , I want csv file to have just the result of the SQL query and nothing else.

Upvotes: 0

Views: 2094

Answers (1)

Rene
Rene

Reputation: 10541

Put your commands in a file. Then run that from SQLPUS.

So for instance make a file query.sql.

SQL>@query.sql

Now SQL won't put the query in the spoolfile.

This way SQLPLUS will listen to your set .. off commands. See the documentation.

*SET ECHO {ON | OFF} Controls whether or not to echo commands in a script that is executed with @, @@ or START. ON displays the commands on screen. OFF suppresses the display. ECHO does not affect the display of commands you enter interactively or redirect to SQLPlus from the operating system.**

Upvotes: 3

Related Questions