Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6005193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:21:58+00:00 2026-05-23T01:21:58+00:00

declare type array is table of src%rowtype index by binary_integer; l_data array ; begin

  • 0
declare
type array is table of src%rowtype index by binary_integer;
l_data array ;

begin

loop

  begin
      select * bulk collect into l_data
        from src
       where processed = 'N'
         and rownum < 10
         for update of processed;
      exit when sql%rowcount = 0;
  exception
       when no_data_found then exit;
  end;

for i in 1 .. l_data.count
    loop
        update tgt set x = l_data(i).x , y = l_data(i).y where rowid = l_data(i).tgt_row_id  ;
        update src set processed = 'Y' where tgt_row_id = l_data(i).tgt_row_id;
    end loop;

commit; 



end loop;

end;
/

I editied the code to use bulk collect but it simply hangs in 11.2.

SQL> select * from src;

         X Y          TGT_ROW_ID         P
---------- ---------- ------------------ -
         1 ABC        AAAWZDAAEAAAA1EAAA Y
         1 DEF        AAAWZDAAEAAAA1EAAA Y
         2 ABC        AAAWZDAAEAAAA1EAAC Y

SQL> select * from tgt;

         X Y
---------- ----------
         1 ABC
         1
         2 ABC
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:21:58+00:00Added an answer on May 23, 2026 at 1:21 am

    There are really several questions here.

    1) The error on line 10. That is because you need to use BULK COLLECT to select into an array:

    select x,y,tgt_row_id 
    bulk collect into l_data
    from src
    

    However, since l_data is defined using src%rowtype the above only works if the table has just the 3 columns x,y,tgt_row_id. When using%rowtype it is actually better to use select * as it is sure to match the record structure.

    2) Your loop never exits. You need to add something like this:

    loop
      select * bulk collect into l_data
        from src
       where processed = 'N'
         and rownum < 10
         for update of processed;
    
       exit when sql%rowcount = 0;
       ...
    end loop;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can declare an array of maps using generics to specify the map type:
I want to declare an array with element-type of a variant record. Something like
When you declare a type parameter for the class, you can simply use that
What is the syntax to declare a type for my compare-function generator in code
If you declare variables of type byte or short and attempt to perform arithmetic
Is there a way to forward-declare the HINSTANCE type from the WinAPI without including
In Oracle I can declare a reference cursor... TYPE t_spool IS REF CURSOR RETURN
Is it possible to declare an instance of a generic without knowing the type
Is there a way to declare that the variable type of a generic class
How do I declare the types of the parameters in order to circumvent type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.