can I use a case in oracle 11g to do some operations(within PL/SQL) or it has to return a value, I mean, i can do this in mysql:
Select <column> from <table> where <conditions>;
case <column>
when 1 then
-- Quite many processes, queries, inserts, etc
when 2 then
-- some complex code
-- And so on
Is it possible to achieve in oracle ?
I also would like to know if I can do this, ’cause im getting an oracle error in that line
i mean, set some variables in ELSE’s Case statement
CASE WHEN <condition> THEN varY := z ELSE var1:= x, var2:=x, var3:=y END
If you’re really talking about PL/SQL, the code you can certainly do multiple operations in a
CASEstatement. The code that you posted should work just fine other than the syntax error where aCASEstatement in PL/SQL ends withEND CASEnotEND.If you are talking about SQL, rather than PL/SQL, then no, you cannot embed procedural statements like assigning PL/SQL variables in a
CASEstatement in SQL.