Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-06502: PL/SQL: numeric or value error: NULL index table key value

447194Aug 25 2005 — edited Aug 25 2005
SQL> ed
Wrote file afiedt.buf

1 create or replace procedure ex
2 as
3 type aa is table of emp%rowtype index by binary_integer;
4 rec aa;
5 begin
6 FOR i IN (SELECT *
7 FROM emp)
8 LOOP
9 rec (SQL%ROWCOUNT) := i;
10 END LOOP;
11 FORALL indx IN rec.FIRST .. rec.LAST
12 INSERT INTO aa VALUES rec(indx);
13* end;
SQL> /
Procedure created.

SQL> create table aa as select * from emp where 0=9;

Table created.


SQL> execute ex;
BEGIN ex; END;

*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: NULL index table key value
ORA-06512: at "SCOTT.EX", line 9
ORA-06512: at line 1


Here I am trying to insert all rows from emp table to aa table but I am getting above error can help me out what kind of error that is.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 22 2005
Added on Aug 25 2005
6 comments
10,059 views