| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.misc -> Re: Is it possible to pass args. to a sql script
To pass arguments to a SQLplus script, just use &1 for the first argument, &2 for the second and so on.
/home/username/sqlplus username/password @scriptb arg1 arg2 arg3 ....
Then inside your script B have something similar to this:
//Script B.sql
declare
 counter integer:=&1;
 mydate date:=to_date('&2','MON-DD-YY');
 counter2 integer:=&1;
...
begin
//script body here
end
Hope this helps you,
Chad J. Molina
DanHW wrote:
> >I have a sql-script in a file which i execute from sql-plus, but is
 it
> >possible to pass arguments when I execute this script?
 
> >Casper Thrane
>
> If I understand correctly, script A calls script B, and you want A to
> communicate some parameters to B. If this is true, then it is very
> easy.
>
> In script define and load the values you want, either via a select or
> using the
> DEFINE. In script B, they still exist, so they are known.
>
> DEFINE my_value="A"
> ...
> @B.SQL
>
> ---> B.SQL can reference and use "&my_value" and it will have the
> value "A", as
> set in script A.
>
> Dan
Received on Mon Nov 24 1997 - 00:00:00 CST
|  |  |