Easy learning with example program codes

Oracle pl sql goto statement tutorial

Pl sql goto statement:

The pl sql goto statement provides an unconditional jump from the GOTO to a labeled statement in the same subprogram. A label can be declare with the << label >> syntax.

pl sql goto statement syntax:

GOTO label_name;  
 //Other statements  

Pl sql goto statement example:

   num number := 1;
   -- while loop execution 
   WHILE num <= 10 LOOP
      dbms_output.put_line ('Value of num: ' || num);
      num := num + 1;
      IF num = 5 THEN
         num := num + 1;
         GOTO loop1;
      END IF;


Value of num: 1
Value of num: 2
Value of num: 3
Value of num: 4
Value of num: 6
Value of num: 7
Value of num: 8
Value of num: 9
Value of num: 10

Pl sql goto statement restrictions:

1. GOTO statement cannot transfer control into an IF statement, CASE statement, LOOP statement or sub-block.
2. GOTO statement cannot transfer control from one IF statement clause to another or from one CASE statement WHEN clause to another.
3. GOTO statement cannot transfer control from an outer block into a sub-block.
4. GOTO statement cannot transfer control out of a subprogram.
5. GOTO statement cannot transfer control into an exception handler.

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki