Re: PL/SQL ACCEPT command: how does it work?
From: Mike Dwyer <dwyermj_at_co,larimer.co.us>
Date: Wed, 6 Sep 2000 08:57:09 -0600
Message-ID: <o0tt5.20$wU6.6215_at_wdc-read-01.qwest.net>
7
7
Date: Wed, 6 Sep 2000 08:57:09 -0600
Message-ID: <o0tt5.20$wU6.6215_at_wdc-read-01.qwest.net>
"variable" created a *bind* variable which must be given a value in pl/sql. "accept" created a sql*plus parameter variable and assigned it a value of 3. "print" will print the bind variable, x, which is null. The bind variable isreferenced as :x, and the parameter variable as &x, and they may each have a separate value. See below:
<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
[Quoted] <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:57:09 CEST