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!

loop cursor in plsql

pjsiong-JavaNetSep 15 2011 — edited Sep 15 2011
Hi,
I create a procedure which is something like below:
create or replace procedure INSERT_DATA is
cursor cursor1(vfield varchar2) is
(
select field1,field2,field3,field4
 from tableb z, xmltable( .....) x
       where z.field1=vfield
       );  

begin
  for c in (select fieldname from tablea)
  loop
    for t in cursor1(c.fieldname)
    loop
     insert into tablec 
      (field1,field2,field3,field4)
      values
      (t.field1,t.field2,t.field3,t.field4);
    end loop;  
    commit;
  end loop;

   
end INSERT_DATA;
when I run this procedure, I found that the memory usage of Oracle process in the server will keep increasing,
I want to run this procedure against some huge table, if the memory usage keep increase, I am afraid that it will exhaust the memory.
Is there any way to improve this?

Thanks

Vincent

Edited by: pj**** on 15-Sep-2011 00:42

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 13 2011
Added on Sep 15 2011
12 comments
189 views