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!

Need help in procedure going into infinite loop making deadlock on second table.

ReemaPuriJun 13 2016 — edited Jun 13 2016

Hi ,

Actuall i was trying the below link to see the performance difffernce

but using the simple  cursor it went into infinite loop

making a deadlock on second table test_emp2

can anybody tell what mistake i am doing ?

link:-

Refer :- https://venzi.wordpress.com/2007/09/27/bulk-collect-forall-vs-cursor-for-loop/

create table test_emp1

(

id number

);

begin

for i in 1..100 loop

insert into test_emp1 values(i);

end loop;

end ;

create table test_emp2

( id number

);

create or replace procedure cursor_test

is

cursor c1 is select id from

test_emp1;

l_id varchar2(100);

begin

dbms_output.put_line('before insert'||systimestamp);

open c1 ;

loop

fetch c1 into  l_id ;

insert into test_emp2 values(l_id);

end loop;

close c1;

dbms_output.put_line('after inserting' ||systimestamp);

end ;

This post has been answered by Solomon Yakobson on Jun 13 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 11 2016
Added on Jun 13 2016
2 comments
1,057 views