Skip to main content

Use EXIT WHEN instead of an IF statement to exit from a loop

ZPA rule for PL/SQL and Oracle SQL · IfWithExit

To improve the code readability always use EXIT WHEN instead of an IF statement to exit from a loop.

Examples​

Noncompliant Code Example
if condition1 then
exit;
end if;
Compliant Solution
exit when condition1;