Mega Code Archive

 
Categories / Oracle PLSQL / PL SQL
 

WHILE Loop

SQL> SQL> DECLARE   2     v_count PLS_INTEGER := 1;   3  BEGIN   4     WHILE v_count <= 20   5     LOOP   6        DBMS_OUTPUT.PUT_LINE('While loop iteration: '||v_count);   7        v_count := v_count + 1;   8     END LOOP;   9  END;  10  / While loop iteration: 1 While loop iteration: 2 While loop iteration: 3 While loop iteration: 4 While loop iteration: 5 While loop iteration: 6 While loop iteration: 7 While loop iteration: 8 While loop iteration: 9 While loop iteration: 10 While loop iteration: 11 While loop iteration: 12 While loop iteration: 13 While loop iteration: 14 While loop iteration: 15 While loop iteration: 16 While loop iteration: 17 While loop iteration: 18 While loop iteration: 19 While loop iteration: 20 PL/SQL procedure successfully completed. SQL>