0

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.

3
  • What is the content of test.txt? Maybe that contains commands to turn some setting back on? Commented Apr 2, 2015 at 5:48
  • test.txt is empty. This file is suppose to capture sql query as output generated by spool. Commented Apr 2, 2015 at 5:51
  • That won't work. What you a doing is running the contents of @test.txt in sqlplus. Commented Apr 2, 2015 at 5:59

1 Answer 1

3

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.**

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.