Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to read/use a system unix variable from sql ?

Re: How to read/use a system unix variable from sql ?

From: KeyStroke (Jack L. Swayze Sr.) <KeyStrk_at_Feist.Com>
Date: Thu, 26 Nov 1998 19:52:56 -0600
Message-ID: <365E05F8.98E440A9@Feist.Com>


Anytime you invoke a SQL script, you will be naming it after the userid/password_at_instance like so:

sqlplus userid/password_at_my_instance.world the_sql_scrpit.sql

at that time, you can pass a value into the SQL script by putting it after the name of the script like so:

sqlplus userid/password_at_my_instance.world the_sql_script.sql the_value

Then, inside the SQL script, you reference "the_value" using &1 (which stands for the first value on the command line)

You can use &1 anywhere in the script. However, if you need to have a period after it (for instance, if you were passing in the name of the instance) then you need to put two periods after it in the code, instead of just one.

If you need to pass more than one value, just do so, one after anohter separated by a space and reference each with &2 and &3 and so on.

max wrote:

> Hi,
> I'm working on oracle 7.3 on windows NT and Unix Solaris environment.
> I need to use (to read) a system variable in a sql script.
> I had problem in both the environment.
> On Unix, the only way that works is :
> spool $MY_DIRECTORY/MY_FILE
>
> If I try to read/use a system variable with other sqlplus commands it
> doesn't work. What I need is to store the value of a system variable
> into a sql*plus variable (or, better, a pl/sql variable) to use it
> later.
>
> On windows NT I have the same problem.
> Any idea ?
> Max rome(italy)
Received on Thu Nov 26 1998 - 19:52:56 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US