Mega Code Archive

 
Categories / Oracle PLSQL / PL SQL
 

The scope of the index of a FOR LOOP

SQL> SQL> CREATE TABLE MyTable (   2    num_col    NUMBER,   3    char_col   VARCHAR2(60)   4    ); Table created. SQL> SQL> DECLARE   2    v_Counter  NUMBER := 7;   3  BEGIN   4    INSERT INTO MyTable (num_col)   5      VALUES (v_Counter);   6    FOR v_Counter IN 20..30 LOOP   7      INSERT INTO MyTable (num_col)   8        VALUES (v_Counter);   9    END LOOP;  10    INSERT INTO MyTable (num_col)  11      VALUES (v_Counter);  12  END;  13  / PL/SQL procedure successfully completed. SQL> SQL> drop table MyTable; Table dropped. SQL>