Sleep function

Hi,
I have used sleep function in my pl/sql code. I have written the code as below:
create or replace package ab is
procedure def ;
PROCEDURE TEST_SLEEP(TIME1 NUMBER);
end ab;
create or replace package body ab is
PROCEDURE TEST_SLEEP
TIME1 IN NUMBER
) IS
BEGIN
DBMS_LOCK.sleep(TIME1);
END TEST_SLEEP;
procedure def is
begin
for i in 1 .. 5 loop
if i=5 then
TEST_SLEEP(i);
DBMS_OUTPUT.PUT_LINE(I);
end if;
if i=1 then
TEST_SLEEP(i);
DBMS_OUTPUT.PUT_LINE(I);
end if;
if i=3 then
TEST_SLEEP(i);
DBMS_OUTPUT.PUT_LINE(I);
end if;
if i=4 then
TEST_SLEEP(i);
DBMS_OUTPUT.PUT_LINE(I);
end if;
end loop;
end def;
end ab;
and every time iam calling that procedure to sleep for some time and display the output through def procedure. But in this the output is displaying for all conditions at the end of execution.
any one help me please.
Regards,
Bharat G.

starter wrote:
ya we can recode it to simplify the code. But my requirement is to print the output that shows the time difference of an execution. That does not mean that one can now forget about simplifying the code. The art of programming is to achieve the requirements with as few lines of code as possible. Simplicity is the ultimate form of elegance.
At the end of procedure execution the output is displaying normally, but i want the output to display everytime it satisfies the condition. By this I can see that its delaying the execution everytime when it enters into the conditional statements.Do not really understand what the requirement is that you describe. Keep in mind that PL/SQL code is server-side code. It run inside a server process.
So the client makes a PL/SQL: begin MyPackage.FooProc( :var1 ); end;
This is received by the server. Is parsed. Is executed. And the COMPLETE call is executed. Including all DBMS_OUTPUT calls.
The call is completed. The client gets the response code that says it was successful.
The client now makes another call - it requests the DBMS_OUTPUT buffer from the session. It receives the contents from the server and renders it.
DBMS_OUTPUT is NOT an interactive display device. It does NOT write to the client display.

Similar Messages

  • Since I installed Lion on my macbook the LED light does not pulse when I close the screen - the sleep function does not work.

    Since I installed Lion on my macbook the LED light does not pulse when I close the screen - the sleep function does not work neither when chosen after pressing the button nor chosen in the apple menu..

    I have had the same problem but on another forum it was suggested that disabling internet sharing would solve this. This fix seems to work on my machine - why it works I do not understand

  • Need help in using sleep function in pl/sql

    Hi,
    need help:
    I have a condition where i want to validate total_pass=total_fail and
    I want to use the sleep function in a pl/sql where i want to wait for 2 minutes ie.checking
    whether total_pass=total_fail based upon class_id .
    I have the data in the table as:
    CLASS_ID TOT_PASS TOT_FAIL
    1 10 10
    2 5 4
    3 6 6
    4 7 5
    Any help will be needful for me

    I'm not quite sure what you are lookg for here, but whatever it is, your code as posted won't do it. You will never break out of the WHILE r_Class.Tot_Pass = r_Class.Tot_Fail loop, since these values will never change because you never get the next record form the cursor.
    From your original data, it looks like your cursor will return multiple rows which implies to me that you want to fetch the first row from the cursor, check if tot_pass = tot_fail, if they are equal, sleep for two minutes then get the next row. This does not make sense to me. Once the select in the cursor is executed, the data it returns will not change due to Oracle's read consistency model, so there seems to me no point in the sleep.
    The other alternative I can see is that you want to check all the returned rows, and if tot_pass = tot_fail for one of the rows (or possibly for all of the rows), then you want to sleep and try again.
    If you can explain in words what it is you are trying to accomplish, someone will be able to point you to a solution.
    John

  • External FW/USB Western Digital, Seagate Disk Drives and 'Sleep' function

    As you are aware, most external disk drives be they FW or USB (and irrespective of the manufacturer, save for LaCie) have a 'sleep' function built into their Firmware. In the case of the Western Digital and Seagate Ext FW drives I have, this function cannot be disabled and this per both WD and Seagate.
    Unfortunately this is extremely annoying if using Photoshop and Bridge...it takes about ten seconds for each disk to spin up while the latter programs search the drives. (In Windows this can be enabled/disabled. Not so with the Mac O/S I have been told). Multiply this by six of the aforementioned drives and it can be quite time consuming.
    Is there an OS-X workaround for this?
    Thanks again,
    Lyman

    I always avoid vendor cases. Might want to look at an Oxford 912 etc, or better yet, why use Firewire when eSATA works so well?

  • I can't use the sleep functions, is it a bug?

    i just updated my Ipod to 1.2 .And i found the sleep function is not available. there is no menu to set the sleep time. when i put the sleep menu , my nano turns off immediately. is it a software bug?

    i have had the answer.
    the sleep function can't be used as a sleep timer.the sleep timer is set in clock menu.

  • Sleep Function in PL/SQL

    Hi Guys,
    I am creating a procedure which will check for the fileld in the database and if it returns NULL should go to sleep for 15 minutes and then will again check for the field. I am planning to use DBMS_LOCK.SLEEP function. Please can you suggest if the same is fine or advise if in case there is any other specific function which I require to use as I have read that the mentioned function is not accurate in calculating the SLEEP time.
    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6019886867656]
    Best Regards,
    Shaz

    Summary of DBMS_LOCK Subprograms
    Table 53-3 DBMS_LOCK Package Subprograms
    Subprogram Description
    ALLOCATE_UNIQUE Procedure
    Allocates a unique lock ID to a named lock.
    CONVERT Function
    Converts a lock from one mode to another.
    RELEASE Function
    Releases a lock.
    REQUEST Function
    Requests a lock of a specific mode.
    SLEEP Procedure
    Puts a procedure to sleep for a specific time.
    PL/SQL lock timer
    Definition: This Wait-Event represents the amount of time a user or application has “slept” through the USER_LOCK.SLEEP or DBMS_LOCK.SLEEP procedures.
    When investigating Oracle Wait-Events, the lion's share of time is spent looking at those events where applications consume precious system resources or are in direct contention with other users or applications. These resource waits revolve around excessive CPU, memory, or disk usage. Events that spin for Oracle internal structures such as latches or enqueues can also be of concern. As their name suggests, Wait-Events DO ‘wait’ on some event to complete before a user or application can continue with its work. Contention for system resources will overwhelm Oracle’s ability to immediately process the SQL and ultimately cause applications to accumulate time in resource specific Wait-Events.
    On the flip-side of resource waits there are what are called idle events. These events do not wait for any specific resource but record the time Oracle is waiting for a work request from the application. Many practitioners of Oracle performance will not even look at these idle events because they do not consume resources and are not limiting what Oracle can do at any given point in time. Some will even go so far as to state that the idle events have no meaningful information. This is not necessarily true. Take for instance the idle event ‘SQL*Net message from client’. This idle event is not inhibiting the database server from performing work but, as many agree, is an indication of poor response from client to database server. While idle events are not the result of direct resource contention, they are an accurate measure of accumulated delays in the application imposed by Oracle.
    The ‘idle’ event “PL/SQL lock timer” is worth watching because it points us in the direction of application response, throughput, and possible coding issues. The PL/SQL lock timer event is, as the command that issues it states, a sleep mandated by the application code. The application is idle and doing nothing. This means that if the application sleeps for a combined interval of 5 minutes, the response to the user or complete run of the application will take at least 5 minutes longer.
    While this event does not require resources and thus is not an Oracle resource contention issue, it is our job to provide the quickest response to users and push applications through our system to increase the user’s perceived performance.
    Most often, sleeps are put into an application for serialization of transactional events or spinning on queues until something happens. When the event occurs or a queue is populated, then the application continues its work. We should ask ourselves why an application is sleeping for any amount of time and provide alternatives if necessary to reduce this idle event. You will gain quicker responses if you trigger an action instead of the action waiting for an event.
    How to look at the PL/SQL lock timer event
    To initiate a sleep for the current session for five seconds.
    SQL> execute sys.dbms_lock.sleep(5);
    To take a look at current sessions that are using the SLEEP command. Notice that the column P1 in V$SESSION does not represent the amount of time the session has slept but in fact represents the duration this session will sleep. Also note that this column is in centiseconds and as such the five seconds issued for a sleep has been translated in to 500 centiseconds.
    SQL> select osuser,event,p1 from v$session where event = 'PL/SQL lock timer'
    OSUSER EVENT P1
    Johnny Smith PL/SQL lock timer 500

  • SLEEP FUNCTION QUESTION

    I have a Pearl 8130 (Verizon). 
    I am inquiring about the "sleep" function that happens when you buy a case with a magnet flipper.  Does it just dim the screen immediately?  Or does it do something else?  I'm curious because i bought a flipper case that I'm not pleased with and basically only wanted it for that function - does it REALLY save the battery?  Is it that necessary.  Thanks!
    Solved!
    Go to Solution.

    No it is not the same, as the sleeper magnet puts the BB to sleep in other ways, while in the holster. Dimming the backlight to 80% is a good battery saving tip as well, but is not the same as putting the BB to sleep in the holster.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Replace the wait with java embedding thread.sleep() function

    Hi,
    How to replace the wait with java embedding thread.sleep() function. Can anyone help.
    Thanks.

    drag and drop the java embedding component
    include the following code in it.
    try{ 
    Thread.sleep(60000);
    }catch(Exception e)
    --Prasanna                                                                                                                                                                                                                                                                                                                           

  • IPod sleep function stopped working, Any ideas?

    I can't seem to get the sleep function to work on my iPod. When I click on 60 minutes, nothing happens and the iPod never turns off. Does anyone know how this works?
    George
    HP media center   Windows ME  

    Besides making sure the hold switch is off etc... has it worked before? If so, did you have it plugged in usb and headphones? Have you changed what is plugged in? If it worked and you changed nothing then try a simple reset first..then go to those 5 R's
    Good Luck,
    -j

  • How to repair the sleep function with the latest version 10.8?

    After installing 10.8 I have a problem with the "sleep" function. When I use this by hand my iMac shut down and have to restart.
    This problem doesen't appear when I use the automatic one (in my case shut the iMac down after 15 minutes) and can I use the my iMac without any problem after touching the spacebar.

    http://support.apple.com/kb/HT3964?viewlocale=en_US

  • Nano 4G - Sleep function and volume question

    Hey all,
    i'm owning my first ipod right now and i'm kinda disappointed...mainly concerning two things..I hope someone more experienced with a ipod can assist me...
    1. problem: sleep function @ ipod 4G..is there one? i didn't find anything to auto-shut-off the decive after eg. XX minutes...
    2. problem: volume: even when I decrease the volume to the minimum, it's still too loud..I would like the volume to be lower to listen eg. to the ipod when falling asleep..is a bigger decrease of the volume possible?
    best rgds,
    max

    to clarify it: i mean a SLEEP TIMER, the function which should switch off the ipod after a specified time period...it's impossible that the ipod 4g doensn't offer that STANDARD feature...

  • IPhone 4s iOS6 Music Player Sleep Function

    Am I missung something in the music player on the iPhone.  Is there no Sleep Function? If there is no sleep function how could Apple overlook this feature.  I remember having it on my iPod Classic.

    Not sure why you are having problems. I have had no problems with my 4S playing music after the update. Hopefully you will get it worked out.

  • Has the nano 6th the "sleep" function?

    Has the nano the "sleep" function?. I mean, if you can set 20 minutes (for example) and if you don't press any button, it turn off automatically at 20 minutes.
    Very useful to sleep listening to music.
    Thanks.

    Read the PDF user manual:  iPod Manuals 

  • Sleep function = wireless problem?

    I have an Intel iMac 2.4 GHz/OS 10.5.2 (the earlier version of Leopard came pre-installed) and a lynksis router.
    Like many others I experienced an unstable wireless connection from day 1 with this computer. The other two Macs in the house, both running Tiger had and have no such problem.
    Changing the router channel from 6 to 3 seemed to help somewhat, but the problem persisted.
    I noticed it was worse when the computer had just been wakened from sleep. That is, the wireless signal would start strong then quickly fade away. I found that putting the computer back to sleep, then immediately waking it up would restore the signal, but I often had to do this a dozen times during a session of an hour or so.
    Since there seemed to be some connection between the sleep function and the wireless connectivity I decided to experiment. I went to System Preferences/Energy Saver and set the sleep function to Never. The screen is still set to black out after fifteen minutes. So now the computer is awake all the time, only the screen darkens after some inactivity.
    For three days now the wireless signal has been extremely robust - no fading out whatsoever and the bars have remained at full strength. This certainly doesn't explain the cause of the problem, but it does seem to be an effective work-around, at least so far.
    Has anyone else had a similar experience? And can anyone explain why the sleep function would affect wireless connectivity?

    That a graphics update would fix the sleep function (not to mention the associated wireless issues) seemed odd to me too. I'm just reporting what the Apple tech said. I do have the impression that if they really can't solve your problem their next objective is to get the caller off the line as pleasantly as possible. That may possibly be the case here.
    I would certainly be interested to know if anyone else has a similar problem. The two necessary conditions seem to be:
    1. Sleep function (as set from System Preferences) unreliable, e.g. doesn't always put the computer to sleep, sometimes invokes such a deep sleep that the computer must be unplugged to restart, sometimes wakes up by itself;and
    2. Wireless signal slows to a crawl shortly after awakening from sleep (and in my case, remains unstable, requiring toggling sleep on/off or airport card on/off to resume strong signal.)
    As long as I have the sleep function set to Never the wireless problem disappears. It's been almost two weeks now, so I'm pretty sure there's some link between the two conditions. After the last software update from Apple a couple of days ago I reset the sleep function back to 15 minutes and the wireless fade immediately started up again. Reset it to Never, and, voila!, no problem since.
    I hope anyone else who has both sleep and wireless problems will try this. So far it's the first reliable clue I've found regarding the issue of unstable wireless.

  • Sleep function became invalid when firefox open some web page

    I am a game programer, I found some problem recently, I found my game program's sleep function became invalid when firefox open some web page.

    I am a game programer, I found some problem recently, I found my game program's sleep function became invalid when firefox open some web page.

Maybe you are looking for

  • Scenario: Idoc - XI - external system (Idoc)

    Hello, I am trying to send an idoc from an sap 4.6c system to an external system. The external system is supporting idcos with trfc. This scenario is currently working with ALE. Now i have to set XI between these two systems. My problem is to set up

  • Can we have a search and find widget in Muse?

    Customers want the ability to search for content in our muse sites. This way we can also use Muse to built Portals, etc... So I believe this a widget we need!

  • Why do I get -18001 Errors using Customised TestStand User Interface

    Hi all I have a problem when attempting to run my application on my host NT PC. I have a customised operator interface to TestStand written using Labview 5.1.1 and built using the LabVIEW application builder. I am running the TestStand Development (R

  • Why bind doesn' work?

    Hi, please help me to understand why bind doesn't work. Here is my code: /** Simple enum used in bean. */ public enum CommandType {     NOP, CREATE, UPDATE, DELETE, MOVE; /** just simple bean. */ public class Command {     private CommandType command

  • Webdb 2.0.5.7.1 to 2.2

    I need to get to 2.2 but I cannot find anything to get me there. Please dont tell me they totally dropped this app! I am aware of this new "Portal" but it requires 9i (or 8i) but I run oracle 8 enterprize (not the "i" version) and I run webdb 2.0. My