Re: PL/SQL ACCEPT command: how does it work?
Date: Wed, 06 Sep 2000 10:34:44 +0200
Message-ID: <39B601A4.4B3564AD_at_crpa.it>
[Quoted] 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 ;
[Quoted] Is that correct or there is a better/simpler way to do that?
Best wishes, Cristian
Conan wrote :
> the accept coomand prompts the user for an input and stores the result
in a
> sqlplus substitution variable, similiar to the ones created by define
>
> SQL> accept x prompt 'Enter Value: '
> Enter Value: 123
>
> 123
>
> 123
>
> SQL>
>
> the variable command creates a bind variable, this can be set in a numb
er of
> ways
>
> begin
> :x := '123';
> end;
>
> create procedure test(myvar varchar out)
> is
> begin
> myvar :='123';
> end;
>
> HTH
>
> Conan
>
> Cristian Veronesi wrote in message <39B5F5A8.C5D26C91_at_crpa.it>...
> Why the user input is not stored into the variable?
>
> ----- file p.sql ------
> variable x varchar2(20)
> accept x prompt 'x: '
> print x
> -----------------------
>
> SQL> start p
> x: 3
>
> X
> --------------------------------
>
> SQL>
>
> --
> Cristian Veronesi ><(((( > http://www.crpa.it
>
> Haste is of the devil, and tardiness from the All-Merciful
> (oriental proverb)
-- Cristian Veronesi ><(((( > http://www.crpa.it Haste is of the devil, and tardiness from the All-Merciful (oriental proverb)Received on Wed Sep 06 2000 - 10:34:44 CEST