RE: UNIX exit/no exit...

From: Martin Farber <farber_at_nynexst.com>
Date: 25 May 1994 19:12:25 GMT
Message-ID: <2s07uq$286_at_news.nynexst.com>


In article 769418093snz_at_nuts.demon.co.uk, simon_at_nuts.demon.co.uk (Simon Bonnick) writes:
>In article <Cq27py.GD7_at_netnews.whoi.edu>
> dhiltz_at_whsun1.wh.whoi.edu "David Hiltz" writes:
>>
>> If have a few SQL scripts that I would like to run with and without EXITs at
>> the end. Sometimes
>> I want to run the scripts from the Unix prompt and return to the Unix prompt
>> when done (use an EXIT)
>> and other times I want to run a script from the Unix prompt and then be left
>> in SQL*Plus to perform other
>> operations.
>>
>> I can do it by creating a temporary file, but was wondering if there was a
>> more elegant method.
>>
>
>script.sql has no exit command at the end
>
>to run a script and return to unix:
> sqlplus user/pass <script.sql
>
>to run the same script and remain in SQL*Plus:
> sqlplus user/pass _at_script.sql
>
>
>cheers,
>--
>Simon Bonnick simon_at_nuts.demon.co.uk +44 860 852845 simon_at_trimcase.com

That works, but doesn't allow for parameters on the calling line.

Another possibility is an SQL script that only does a START and and exit:

doit.sql



start &1
exit

To call it you'd have to play what we in the bowels of UNIX lovingly call the "quote game":

$ cat real.sql
col parm1 newline
col parm2 newline
col parm3 newline

   select '&1' parm1
        , '&2' parm2
        , '&3' parm3
     from dual

/
$
$ sqlplus scott/tiger -s _at_doit \'real.sql \"This is param1\" \"This is param2\" \"This is param3\" \'

PARM1



PARM2

PARM3

This is param1
This is param2
This is param3

*NOTE* I didn't say it was elegant. I just said it allowed for parameters!

Happy computing!!!

 Sincerely,

Martin Farber
Independent Oracle Consultant

                        |  NYNEX Science & Technology
                        |  500 Westchester Ave, Rm 1D10
                        |  White Plains, NY  10604
                        |     -----------------
                        |  email: farber_at_nynexst.com
                        |  Voice: 914/644-2656
                        |    FAX: 914/644-2216
Received on Wed May 25 1994 - 21:12:25 CEST

Original text of this message