Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Statements
 

Nested loops

SQL> SQL> declare   2      v_ind     NUMBER;   3      v_current NUMBER;   4  begin   5      v_current:=0; -- should not be null!   6      loop   7          v_ind:=0; -- reset each time   8          loop   9              v_ind:=v_ind+1;  10              DBMS_OUTPUT.put_line(v_current);  11              exit when v_ind=4;  12          end loop;  13          v_current:=v_current+5;  14          exit when v_current=25;  15      end loop;  16  end;  17  / 0 5 10 15 20 PL/SQL procedure successfully completed. SQL>