Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Using ACCEPT and PROMPT in PL/SQL scripts
ACCEPT and PROMPT are SQL*Plus commands and cannot be used in a PL/SQL
block. If you want to get values from your user, then you need to prompt
before you start your PL/SQL block. Something similar to the following
should help you see the difference:
ORA9I SQL> create table test (id number);
Table created.
ORA9I SQL> accept total prompt "Enter total: "
Enter total: 12
ORA9I SQL> begin
2 insert into test values ( &total );
3 end;
4 /
old 2: insert into test values ( &total );
new 2: insert into test values ( 12 );
PL/SQL procedure successfully completed.
ORA9I SQL> select * from test;
ID
12
HTH,
Brian
Received on Tue Oct 29 2002 - 11:14:34 CST
![]() |
![]() |