Home » SQL & PL/SQL » Client Tools » supressing output
supressing output [message #531750] Thu, 17 November 2011 08:46 Go to next message
BeefStu
Messages: 192
Registered: October 2011
Senior Member
Is there some "set" command I can use to make sure the output
of my query ONLY goes to my spool file. Currently, I see
it going to a SPOOL FILE and being displayed to my screen.


sqlplus -s / <<END
spool \\$SPOOL_FILE
set pages 0
set verify off
set echo off
set feedback off
set head off
select destination from v\$archive_dest where destination is not null;
spool off;
END

Re: supressing output [message #531751 is a reply to message #531750] Thu, 17 November 2011 08:47 Go to previous messageGo to next message
BlackSwan
Messages: 22839
Registered: January 2009
Senior Member
sqlplus -s / <<END
set pages 0
set verify off
set echo off
set feedback off
set head off
spool \\$SPOOL_FILE
select destination from v\$archive_dest where destination is not null;
spool off;
END
Re: supressing output [message #531753 is a reply to message #531750] Thu, 17 November 2011 08:49 Go to previous messageGo to next message
Michel Cadot
Messages: 59279
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Put the content of the script in a SQL file with the command "set termout off" and call the file.
You cannot suppress the output on the screen in an interactive session (that is command launched at prompt).

Regards
Michel
Re: supressing output [message #531759 is a reply to message #531753] Thu, 17 November 2011 09:03 Go to previous messageGo to next message
BlackSwan
Messages: 22839
Registered: January 2009
Senior Member
bcm@bcm-laptop:~$ cat a.sql
sqlplus -s <<END
user1/user1
set pages 0
set verify off
set echo off
set feedback off
set head off
spool now.lis
select sysdate from dual;
spool off;
exit
END
cat now.lis
bcm@bcm-laptop:~$ sh -x a.sql
+ sqlplus -s
2011-11-17 07:03:31
+ cat now.lis
2011-11-17 07:03:31
bcm@bcm-laptop:~$
Re: supressing output [message #531760 is a reply to message #531759] Thu, 17 November 2011 09:10 Go to previous messageGo to next message
BeefStu
Messages: 192
Registered: October 2011
Senior Member
Thanks all.. I went with the easy way out

JUNK=/tmp/junk.$$
sqlplus -s / >> $JUNK 2>&1 <<EOF
..
..
EOF
Re: supressing output [message #531761 is a reply to message #531760] Thu, 17 November 2011 09:13 Go to previous message
BlackSwan
Messages: 22839
Registered: January 2009
Senior Member
>I went with the easy way out
if you do not throw Standard Error, then no need to redirect/suppress output

I deem my posted code as preferred implementation.
Previous Topic: Basic tools for Oracle version control: wanted!
Next Topic: Dynamic Schema Name at runtime.
Goto Forum:
  


Current Time: Tue Sep 30 13:33:39 CDT 2014

Total time taken to generate the page: 0.06847 seconds