943,863 Members | Top Members by Rank

Ad:
  • Oracle Discussion Thread
  • Unsolved
  • Views: 1370
  • Oracle RSS
Sep 19th, 2008
0

Oracle console stucks

Expand Post »
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;
/
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sqlstarz is offline Offline
7 posts
since Jun 2008
Dec 10th, 2008
0

Re: Oracle console stucks

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 ................................
Reputation Points: 10
Solved Threads: 0
Newbie Poster
like_to_learn is offline Offline
9 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Oracle Forum Timeline: I need the logic behind date syntax
Next Thread in Oracle Forum Timeline: can we display select command with from onedate to present date





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC