Re: PL/SQL ACCEPT command: how does it work?

From: Pierre Charpenay <pcharpenay_at_unilog.fr>
Date: Wed, 06 Sep 2000 13:20:42 +0200
Message-ID: <39B6288A.A1DFFFEE_at_unilog.fr>


Cristian Veronesi a écrit :
>
> Thanks for the explaination Conan. Actually I needed a bind variable but
> I wish to set it via an ACCEPT command. If I understood correctly what
> you said I have to do something like that :
>
> variable bindvar varchar2(4)
> accept subvar prompt 'Please enter substitution variable: '
> execute :bindvar := &subvar
> select * from mytable
> where pkey = :bindvar ;
>
> Is that correct ...

Yes, but ...

> ... or there is a better/simpler way to do that?

... yes again. Just use directly the substitution variable, like this :

accept subvar prompt 'Please enter substitution variable: ' select * from mytable
where pkey = &&bindvar ;

Don't forget the two && (with just one & sqlplus will ask you for a value for bindvar !)

> ...
> --
> Cristian Veronesi ><((((º> http://www.crpa.it
>
> Haste is of the devil, and tardiness from the All-Merciful
> (oriental proverb)
 

-- 
 Pierre CHARPENAY
Received on Wed Sep 06 2000 - 13:20:42 CEST

Original text of this message