The list of WHEN blocks now allows dangling expressions (in red below), that is conditional expressions where the left operand is missing.
DECLARE
x number;
BEGIN
case x
when is null THEN
dbms_output.put_line('null');
when 1 then
dbms_output.put_line('1');
return;
when > 1 then
dbms_output.put_line('greater than 1');
return;
else
dbms_output.put_line('else');
return;
end case;
END;
/The PL/SQL block above would raise PL/SQL parsing errors in earlier versions (PLS-00103 on lines 5 and 10).
It is worth noting that in earlier versions the only way to catch WHEN x IS NULL, would be to replace NULL with some other value or, better, use the "searched" CASE statement instead.
For more information, please refer to the official Oracle 23ai documentation.
No comments:
Post a Comment
I appreciate your comment however bear in mind that I might not have the time to reply soon.
Normally I do not reply to all comments but I am glad if you found something useful or if you learned something new, in that case I strongly encourage you to promote the article with the +1 google button.
Flavio