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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Passing Command Line Parms to Anonymous Procedures in an SQLPLUS script

Re: Passing Command Line Parms to Anonymous Procedures in an SQLPLUS script

From: Steve Ashmore <sashmore_at_neonramp.com>
Date: Sat, 11 May 2002 05:11:47 -0500
Message-ID: <udprj6bjiahf8d@corp.supernews.com>


Sure with a couple of minore modifications:

set serveroutput on
set verify off
declare

vparm1 varchar2(20) := '&1'; -- initalize a variable with the

dbms_output.put_line('First paramater is '||vparm1); dbms_output.put_line('Second paramater is '||vparm2);

end;
/

SQL> @myscript bleep blap
First paramater is bleep
Second paramater is blap

PL/SQL procedure successfully completed.

Stephen C. Ashmore
Brainbench MVP for Oracle Administration http://www.brainbench.com

Author of: 'So You Want to be an Oracle DBA?'

"don hall" <dchall_at_wt.net> wrote in message news:3CDC9DF8.43BC4422_at_wt.net...
> Can this be done? The documentation is not clear.
>
> Example
>
> SQL > @my_script.sql parm1 parm2
>
>
> my_script.sql
>
> set serveroutput on
>
> declare
>
> vparm1 varchar2(20) := parm1 -- initalize a variable with the
> parameter from command line
> vparm2 varchar2(20) := parm2 -- initalize a variable with the
> parameter from command line
> --
> begin
>
> dbms_output.put_line('First paramater is '||vparm1);
> dbms_output.put_line('Second paramater is '||vparm2);
>
> end;
>
> Thanks,
>
> Don Hall
>
>
>
Received on Sat May 11 2002 - 05:11:47 CDT

Original text of this message

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