Re: Passing parameters to sql*plus ??

From: Afshin Ghafoori <ash_at_lantis.demon.co.uk>
Date: 1996/08/14
Message-ID: <839981589.9334.0_at_lantis.demon.co.uk>#1/1


moan_at_sn.no (Alexander Moan) wrote:

>Howdy (or something) !
 

>How do I pass parameters to sqlplus on startup of a script ?
>I have been able to do a workaround to this by using an
>append of define *something* into login.sql from a unix shell-scipt,
>but i don't like this approach.
 

>Is it possible to access Unix env. variables from inside sql*plus ?
 

>Any help appreciated !
 

>--
>----------------------------------------------------------
>| Alexander Moan --:-) moan_at_sn.no |
>| Any statements I make are my own, and are not to be |
>| taken as an statement from my employer. |
>| |
>| Norwgian Defence Command Norway |
>| Home Guard Staff |
>| |
>| "Don't blame me, I just work here !" |
>---------------------------------------------------------

For normal varianbles:
Suppose the folloiwing is in file stuff.sql:

SELECT blah
FROM blah
WHERE field = '&&1' /* char */
AND field2 = &&2 /* numeric */
/

Invoke it thus:

sqlplus <user/passwd> _at_stuff.sql hello 1232

where &&1 will be instantiated to hello and &&2 to 1232

For unix env vars, using Kornshel (ksh):

sqlplus <user/passwd> <<Ash

SELECT '$PWD'
FROM dual
/
Ash

I hope this helps. Received on Wed Aug 14 1996 - 00:00:00 CEST

Original text of this message