> -----Original Message-----
> From: Andrea Oracle [mailto:[EMAIL PROTECTED]]
>
> How to do a if statement with Accept? Like I first
> prompt user for a value, "Accept var prompt ...", then
> based on the value I got, do differenct things.
> (Oracle 815 on Sun)
Since you mention the Accept command, I assume you are using SQL*Plus. If so, you can use the substitution variable set by the Accept statement in a PL/SQL block, like so:
SQL> accept x char prompt "Delete Table (Y/N)? "
Delete Table (Y/N)? N
SQL> begin
2 if '&x' = 'Y'
3 then
4 execute immediate 'drop table t' ;
5 end if ;
6 end ;
7 /
ancien 2 : if '&x' = 'Y'
nouveau 2 : if 'N' = 'Y'
Procédure PL/SQL terminée avec succès.