Re: set SQLPLUS output to system

From: Mark Styles <marks_at_sensible.teleord.co.uk>
Date: 1996/06/07
Message-ID: <4p9a9u$k0f_at_sensible.teleord.co.uk>#1/1


Sunny Siu <xxsiu_at_uta.edu> wrote:
>How can I save the output of a SQLPLUS query to a file in UNIX in
>non-interactive mode? For example:
>
>unix> sqlplus user/passwd _at_myprogram arg1
>
>After running the command on unix, the output will save in a file.
>How can I do it?

Two ways, you can either redirect the output using unix redirection, e.g:

sqlplus -s user/passwd _at_myprogram arg1 > myoutputfile

(the -s stops sqlplus header info)

or you can put spool commands in the SQL script, so myprogram.sql would be something like:

spool myoutputfile

SQL stuff
. . .
. . .

spool off

(replace spool off with spool out to send the output to the default printer)

-- 
# Mark Styles aka Small       -- Opinions expressed here are my own -- #
# marks_at_teleord.co.uk         -- unless otherwise specified         -- #
#       "Psycho-kinesis?  Like how Carrie got even at the prom??"      #
Received on Fri Jun 07 1996 - 00:00:00 CEST

Original text of this message