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!

Subscript Beyond Count/Error in Array DML

MuzzFeb 6 2014 — edited Feb 7 2014

Hi All

I really appreciate your advice regarding the below issue.

I have a big procedure so I cant put my procedure here but I will try to give you some details and might be I can convey my problem and get expert advice from you.

I have some values in PL/SQL collection named as TAB_ABC and then I filter this tab by using if statement and then add it to another tab TAB_ABC_REC and then insert it into my table. something like below.

Begin

     For a in 1..TAB_ABC.COUNT

          LOOP

                    IF TAB_ABC(a).group_no=100 then

                       TAB_ABC_REC.EXTEND(1);--Load values in this collection

                       TAB_ABC_REC(a).Name        :=TAB_ABC(a).Name;

                       TAB_ABC_REC(a).Address    :=TAB_ABC(a).Address;   

                    END IF;

          END LOOP;

               BEGIN

                    FORALL j IN TAB_ABC_REC.FIRST..TAB_ABC_REC.LAST SAVE EXCEPTIONS

                         INSERT INTO ABC

                          (

                              NAME,

                              ADDRESS

                           )

                          VALUES

                           (

                             TAB_ABC_REC(j).Name,

                              TAB_ABC_REC(j).Address

                            );

Exception

---------------

-------------

------------

TAB_ABC_REC.DELETE;

END;

The above code is working fine but some time I received the following errors when I execute my package.

     Subscript Beyond Count

      error in array DML

As a result I got less records but the amazing thing is that some time this procedure runs well without any errors. Please guide how come I get rid of this error. Thanks

Regards

Shu

This post has been answered by Partha Sarathy S on Feb 6 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 7 2014
Added on Feb 6 2014
25 comments
9,492 views