Oracle console stucks

Reply

Join Date: Jun 2008
Posts: 7
Reputation: sqlstarz is an unknown quantity at this point 
Solved Threads: 0
sqlstarz sqlstarz is offline Offline
Newbie Poster

Oracle console stucks

 
0
  #1
Sep 19th, 2008
Hello guys,

Just need to know - wats making oracle to stuck when i run this simple pl-sql module

declare
counter number;
begin
<<outer>>
for counter in 1..10 loop

<<inner>>
loop
insert into lines
values(counter);
exit when counter=6 or counter=8;
end loop inner;
end loop outer;
end;
/
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 9
Reputation: like_to_learn is an unknown quantity at this point 
Solved Threads: 0
like_to_learn's Avatar
like_to_learn like_to_learn is offline Offline
Newbie Poster

Re: Oracle console stucks

 
0
  #2
Dec 10th, 2008
you need to write exit condition for outloop.and one more thing,you need to Decrement the counter value in inner loop ,otherwise it will run for infinite times........................Fist of all you just avoid lables,it will degrade the performance.............................
you can run below code to run this for one time likewise you need to give conditions to terminate loop...........................

declare
counter number;
begin
<<outer>>
for counter in 1..10 loop

<<inner>>

loop
insert into lines
values(counter);
dbms_output.put_line(counter);

exit when counter=1 or counter=8;
end loop inner;
exit when counter=1 or counter=8;
end loop outer;
end;
/
One more thing,what is the need of that condition,counter=1 or counter=8; this or condition is no need,unless if you give the numbers dynamically..................

I think this will help you ................................
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC