Hi Denis, Just thought I'd throw in my $.02. The thing that stands out at me would be the use of "first" and "last" on line 10. I would simply use:
forall i in 1 .. ids.count It's worth a shot. I'm not familiar with the other syntax (though it did work the first time). Good luck -T. On May 7, 3:51 am, denis <denis....@yahoo.com> wrote: > I recieved ORA-06502 when I put the bulk insert in a loop. what could > be the reason? Any help to fix it is greatly appreciated. > > SQL>desc driver; > Name > Null? Type > ----------------------------------------------------------------- > -------- -------------- > > ID > NUMBER > > SQL>desc temp_1; > Name > Null? Type > ----------------------------------------------------------------- > -------- -------------- > > ID > NUMBER > > ===> test 1 without loop is ok > SQL>@test1 > SQL>declare > 2 type idTyp is table of driver%rowtype > 3 index by binary_integer; > 4 ids idTyp; > 5 cursor c is select id from driver; > 6 begin > 7 open c; > 8 -- loop > 9 fetch c bulk collect into ids limit 10; > 10 forall i in ids.first..ids.last > 11 insert into temp_1 values ids(i); > 12 -- exit when c%notfound; > 13 -- end loop; > 14 close c; > 15 end; > 16 / > > PL/SQL procedure successfully completed. > > ===> test 2 with loop failed > > SQL>@test2 > SQL>declare > 2 type idTyp is table of driver%rowtype > 3 index by binary_integer; > 4 ids idTyp; > 5 cursor c is select id from driver; > 6 begin > 7 open c; > 8 loop > 9 fetch c bulk collect into ids limit 10; > 10 forall i in ids.first..ids.last > 11 insert into temp_1 values ids(i); > 12 exit when c%notfound; > 13 end loop; > 14 close c; > 15 end; > 16 / > declare > * > ERROR at line 1: > ORA-06502: PL/SQL: numeric or value error > ORA-06512: at line 10 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---