Use sequential control with the GOTO statement and a block label
SQL>
SQL> DECLARE
2 counter NUMBER := 1;
3 BEGIN
4 WHILE (counter < 5) LOOP
5 IF counter = 2 THEN
6 GOTO loopindex;
7 ELSE
8 dbms_output.put_line('Index ['||counter||'].');
9 END IF;
10 << loopindex >>
11 IF counter >= 1 THEN
12 counter := counter + 1;
13 END IF;
14 END LOOP;
15 END;
16 /
Index [1].
Index [3].
Index [4].
PL/SQL procedure successfully completed.
Related examples in the same category