Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 8th, 2005, 08:33 AM
DBStudent DBStudent is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 54 DBStudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 1 m 34 sec
Reputation Power: 10
WHILE LOOP and stored procedure

hi, i have a stored procedure, pls review it:

DECLARE
control NUMBER;
cnt NUMBER;

BEGIN
control := 1;
cnt := 0;

WHILE control=1 LOOP
BEGIN
SELECT numb INTO tempNumb FROM temp;
cnt := cnt + 1;

IF tempNumb != 10 AND cnt <= 5 THEN
DBMS_LOCK.sleep(60);
ELSE
control := 0;
END IF;
END;
END LOOP;
END;


There is only one row in temp table with numb column, value=1.

The loop will run 5 times if the numb column's value not equal to 10. Each time will delay 60 seconds.


So, i run the stored procedure. When it runs 3rd loop and during delay, i change the temp table numb column to 10, and commit.


However, the stored procedure still run until 5 times and then end the loop.

My question is: Why the stored procedure cannt read the latest value from temp table, which is 10 by now?

Thanks,

Reply With Quote
  #2  
Old November 11th, 2005, 05:07 AM
DBStudent DBStudent is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 54 DBStudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 1 m 34 sec
Reputation Power: 10
Hi,

Does anyone try the code above? Anyone know what and why it happen?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > WHILE LOOP and stored procedure

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap