Mega Code Archive

 
Categories / Oracle PLSQL / PL SQL
 

Try to insert elements 3 through 5

SQL> SQL> CREATE TABLE MyTable (   2    num_col    NUMBER,   3    char_col   VARCHAR2(60)   4    ); Table created. SQL> SQL> SQL> DECLARE   2    TYPE t_Numbers IS TABLE OF NUMBER;   3    v_Numbers t_Numbers := t_Numbers(1, 2, 3, 4, 5);   4  BEGIN   5    v_Numbers.DELETE(4);   6   7    FORALL v_Count IN 3..5   8      INSERT INTO MyTable (num_col) VALUES (v_Numbers(v_Count));   9  END;  10  / DECLARE * ERROR at line 1: ORA-22160: element at index [4] does not exist ORA-06512: at line 7 SQL> SQL> select * from MyTable; no rows selected SQL> SQL> drop table MyTable; Table dropped. SQL>