Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Using ACCEPT and PROMPT in PL/SQL scripts

Re: Using ACCEPT and PROMPT in PL/SQL scripts

From: Brian Peasland <oracle_dba_at_peasland.com>
Date: Tue, 29 Oct 2002 17:14:34 GMT
Message-ID: <3DBEC1FA.A89ED13A@peasland.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US