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: Any trick for preventing sqlplus asking value for &1???

Re: Any trick for preventing sqlplus asking value for &1???

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 4 Mar 2003 21:32:26 -0800
Message-ID: <92eeeff0.0303042132.33da294c@posting.google.com>


DA Morgan <damorgan_at_exesolutions.com> wrote in message news:<3E652564.B71B0020_at_exesolutions.com>...
> Massimiliano wrote:
>
> > Hi,
> >
> > I wrote a scritp which I execute from sqlplus in this way:
> >
> > @script.sql <parameter>
> >
> > In the script I use the parameter (&1).
> >
> > My question is:
> > is it possibile to execute the script without passing the parameter
> > and using some default value?
> > Infact, I must execute the script with or without the parameter. In
> > case I don't pass parameter I wouldn't want sqlplus asking for it.
> >
> > Tia
> >
> > Max
>
> SQL> SET DEFINE OFF
>
> Daniel Morgan

SET DEFINE OFF prevents from defining any variables or passing any command line parameters in the script. But the OP wants to sometime pass a parameter and sometimes not. SET DEFINE OFF will raise "Bind variable 1 not declared" error if there is an &1 declaration in the script... since only way to accept command line params in sqlplus is via &1, &2 etc.

I believe the only solution in this case is to pass a constant default value when no actual value is available and test it in the script.

Regards
/Rauf Sarwar Received on Tue Mar 04 2003 - 23:32:26 CST

Original text of this message

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