Exit to a label : EXIT « PL SQL « Oracle PL / SQL






Exit to a label

  
SQL>
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                  just_a_num := just_a_num + 1;
 10          END LOOP;
 11  END;
 12  /
1
2
3
4
5
6
7
8
9
10

PL/SQL procedure successfully completed.

SQL>

   
  








Related examples in the same category

1.Impact of EXIT in a function
2.Using EXIT with a simple LOOP
3.Using EXIT with a WHILE loop
4.Using EXIT with a FOR loop
5.Unconstrained loop: exit
6.Exit outer loop with 'EXIT LabelName When' statement
7.EXIT WHEN clause.
8.Exit loop since last index value is read.