CodesJava

Easy learning with example program codes

Oracle pl sql loop label tutorial


Pl sql loop label:

The pl sql loop can be labeled by loop labels.

Pl sql loop label syntax:

<< label >>

Pl sql loop label example:

DECLARE
   i number(1);
   j number(1);
BEGIN
   << outer_loop >>
   FOR i IN 1..5 LOOP
      << inner_loop >>
      FOR j IN 1..5 LOOP
         dbms_output.put_line('i is: '|| i || ' and j is: ' || j);
      END loop inner_loop;
   END loop outer_loop;
END;
/

Output:

i is: 1 and j is: 1
i is: 1 and j is: 2
i is: 1 and j is: 3
i is: 1 and j is: 4
i is: 1 and j is: 5
i is: 2 and j is: 1
i is: 2 and j is: 2
i is: 2 and j is: 3
i is: 2 and j is: 4
i is: 2 and j is: 5
i is: 3 and j is: 1
i is: 3 and j is: 2
i is: 3 and j is: 3
i is: 3 and j is: 4
i is: 3 and j is: 5
i is: 4 and j is: 1
i is: 4 and j is: 2
i is: 4 and j is: 3
i is: 4 and j is: 4
i is: 4 and j is: 5
i is: 5 and j is: 1
i is: 5 and j is: 2
i is: 5 and j is: 3
i is: 5 and j is: 4
i is: 5 and j is: 5

 

Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki