Re: Question on SQLPLUS (to store query results in a file)

From: Jean-Marc LHABITANT <lhabitan_at_tholos.belfort.cnet.fr>
Date: 1996/10/23
Message-ID: <lbpg235aipp.fsf_at_tholos.belfort.cnet.fr>#1/1


One solution could be :

sqlplus bla/blabla _at_commandFile "WHERE bla bla bla;"

with your SQL script in the file commandFile where the line $WH
is replaced by
&1

that's all

Jean-Marc

(En Francais : Tu utilises le passage de parametres a l'appel de la procedure, et la substitution dans SQLPLUS se fait avec &1.)

"ERNST & YOUNG" <jlaferri_at_ey.ca> writes:

>
> Hi world,
>
> I use SQLPLUS version 3.3 on AIX. I am currently writing
> a shell script and I have a problem.
>
> I set what it is needed to spool the output on a file. All is
> working ok, except that my output also appear in my
> log file. I dont want my output in the log file, but only in
> the file where I spool. All the SQLPLUS commands are
> directly in the file containing the shell script. I know that
> if I put all the commands in a command file it works
> correctly (the output appears only in the file where it is
> supposed to be spooled... not in the log file). But I cant
> use a command file because I create the WHERE clause
> using a parameter transferred to the script and sometimes
> there is no WHERE clause (only ;). Here is a piece of my code:
>
> WH='WHERE bla bla bla;'
>
> sqlplus bla/blabla <<eof
>
> SET NEWPAGE 0
> SET SPACE 0
> SET PAGESIZE 0
> SET ECHO OFF
> SET FEEDBACK OFF
> SET HEADING OFF
> SET TERMOUT OFF
> --
> -- Extrait de la table reclamation_fixe
> --
> SPOOL rec_fix.ext
> SET LINESIZE 197
> COLUMN dt1 FORMAT A8
> SELECT r_no_reclam, no_cie, ............
> $WH
> SPOOL OFF
> SET TERMOUT ON
> EXIT;
> eof
>
> Do you have a brilliant idea?
>
> Jocelyne Laferriere
> Caron Belanger Ernst & Young
>
Received on Wed Oct 23 1996 - 00:00:00 CEST

Original text of this message