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

From: Mike Dwyer <dwyermj_at_co,larimer.co.us>
Date: Wed, 6 Sep 2000 08:51:32 -0600
Message-ID: <n0tt5.19$wU6.6170_at_wdc-read-01.qwest.net>


You created a bind variable, for pl/sql. Accept created a sql*plus parameter variable. You have :x and &x, which may contain different values. &x is 3; :x is null. Take a look:

<SQL> variable x varchar2(20)
<SQL> accept x prompt 'x: '
x: 3
<SQL> print x

X


<SQL> print &x

Bind variable "3" not declared.
<SQL> select &x from dual;

         3


         3

<SQL> select :x from dual;

:X


<SQL> begin :x := 7; end;
  2 /

PL/SQL procedure successfully completed.

<SQL> print x

X



7

<SQL> print &x

Bind variable "3" not declared.
<SQL> select &x from dual;

         3


         3

<SQL> select :x from dual;

:X



7

"Cristian Veronesi" <c.veronesi_at_crpa.it> wrote in message news: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)
Received on Wed Sep 06 2000 - 16:51:32 CEST

Original text of this message