Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Newbie PL/SQL question
you cannot use SQL*Plus commands inside a PL/SQL block, which is what it looks like you are trying to do.
PROMPT and ACCEPT are SQL*Plus commands, but they are not valid syntax for PL/SQL statements.
the DECLARE, BEGIN and END keywords are elements of the PL/SQL language, but not of SQL*Plus.
your listing looks more like a SQL*Plus script than a PL/SQL block. try removing the PL/SQL schtuff from around your SQL*Plus script.
"Araxes Tharsis" <pnrmaia_at_hotmail.com> wrote in message
news:956i13$qk3$1_at_venus.telepac.pt...
> I can't make it work...
> I get errors on the keyword ACCEPT, and in the SELECT DECODE line.
> Thanks for the help.
>
> DECLARE
> choice NUMBER;
> BEGIN
>
> PROMPT Select an Action from following ugly menu:
> ACCEPT choice PROMPT 'Action1 (1 default), Action2 (2), Action3 (3)'
> default 1
>
> col action_script new_val action_script noprint
> SELECT DECODE(&&choice, 1, 'action1.sql', 2, 'action2.sql', 3,
> 'action3.sql', 'noaction.sql')
> action_script FROM dual;
>
> @&&action_script
> END;
> /
>
>
>
>
Received on Tue Jan 30 2001 - 22:50:08 CST