I want to use the pl/sql case when statement like in java or c++.
I should combine multiple when conditions for the same then block.
Example:
case
when l_var = 1 then
when l_var2 = 2 then
DBMS_OUTPUT.PUT_LINE('true');
else
DBMS_OUTPUT.PUT_LINE('false');
end case;
I know that I could use AND or OR in the when conditions but this is ugly.
Thanks.
Ugliness is in the eye of the beholder. I just look at that syntax and think, “there’s some code missing”.
I really don’t know what you’re expecting. The PL/SQL CASE() syntax doesn’t work the way you would like. So your choices are to use explicit BOOLEAN logic, deploy nested conditions or choose a different programming language..