Exit to a Label : EXIT « PL SQL Statements « Oracle PL/SQL Tutorial






SQL> set serveroutput on
SQL> DECLARE
  2          just_a_num NUMBER := 1;
  3  BEGIN
  4          <<just_a_loop>>
  5          LOOP
  6                  dbms_output.put_line(just_a_num);
  7          EXIT just_a_loop
  8          WHEN (just_a_num >= 10);
  9
 10          just_a_num := just_a_num + 1;
 11          END LOOP;
 12  END;
 13  /
1
2
3
4
5
6
7
8
9
10

PL/SQL procedure successfully completed.

SQL>
SQL>








22.8.EXIT
22.8.1.EXIT a WHILE LOOP
22.8.2.EXIT WHEN
22.8.3.EXIT a FOR LOOP
22.8.4.Exit a function
22.8.5.EXIT statement with Label
22.8.6.Using 'EXIT WHEN' in a loop
22.8.7.EXIT a LOOP WHEN a certain condition
22.8.8.Exit to a Label