CONTINUE WHEN conditionally moves to the next iteration of the loop.
BEGIN FOR idx IN 1..3 LOOP dbms_output.PUT_LINE('-----------------------------------'); dbms_output.PUT_LINE('Idx ' ||idx ||': BeFore Continue. Mod(Idx,2) = ' ||MOD(idx,2)); --------------------------------------------------- -- If Mod(i,2) = 0 THEN --{ This is the -- Continue; -- same as the -- End If; -- Continue When below.} --------------------------------------------------- CONTINUE WHEN MOD(idx,2) = 0; dbms_output.PUT_LINE ('After Continue. Print If Mod(Idx,2) is not 0.'); END LOOP; END; /
Notes:
- When using CONTINUE in a simple loop, make sure you increment your loop before the CONTINUE so you don't create an infinite loop.
- When using CONTINUE in a While loop, try using a GOTO and a label.
- Inlining impacts every call to CONTINUE and CONTINUE WHEN.
No comments:
Post a Comment