How to use the CASE STATEMENT in PL/SQL [message #121895] |
Wed, 01 June 2005 11:47  |
hqluu18
Messages: 2 Registered: June 2005
|
Junior Member |
|
|
Case statement doesn't seem to work in a PL/SQL block.
Please dummy example below:
procedure test is
x number :=1;
y number;
begin
case x
when 1 then y:= 1
when 2 then y:= 2
else y := 0
end
ORA-06550: line 2, column 4:
PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
begin declare exit for goto if loop mod null pragma raise
return select update while <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall
<a single-quoted SQL string>
end
end
ORA-00900: invalid SQL statement
|
|
|
|
|
|
|
|