For Update and Where Current Of -

HI All,
We have been using Select For Update statement with wait time (i.e in seconds) in various places inside our applications. This forces for locking those rows and we commit the work at the end of our work to ensure we release the locked rows to avoid deadlock in the application. However at times we face locks during heavy contention when running those cursors in the application.
I have 2 questions here
1) By using where current of do we stand to gain anything advantageous so that we gain out of it. Will it try to eliminate such row level locks said above.
2) How to avoid locks occurring in the application while using Select For Update Statements
Please share your thoughts and suggestions to overcome on this worrying/concerning topic.
Thanks in advance

ramarun wrote:
HI All,
We have been using Select For Update statement with wait time (i.e in seconds) in various places inside our applications. This forces for locking those rows and we commit the work at the end of our work to ensure we release the locked rows to avoid deadlock in the application. However at times we face locks during heavy contention when running those cursors in the application. FOR UPDATE exists to put locks on selected data so other processes cannot lock data between the time it is selected and processed. As you're finding there are disadvantages.
1) By using where current of do we stand to gain anything advantageous so that we gain out of it. Will it try to eliminate such row level locks said above.WHERE CURRENT OF will save you typing when you do WHERE clauses. It should not affect locking at all
2) How to avoid locks occurring in the application while using Select For Update Statements You don't avoid locks when using the FOR UPDATE clause because that is what its for. If you don't need to lock the data then do not use FOR UPDATE.
Edited by: riedelme on Aug 11, 2010 5:34 AM
Updated after sybrand's comments below. Technically using WHERE CURRENT OF shouldn't affect locking directly - rows will remain locked until the transaction is terminated. Referencing the data via the rowid will be more efficient and therefore shorten the time taken to process the transaction

Similar Messages

  • The Cursor's "For Update " and " Where Current of C1" Error in Form9i

    Hi,
    I use a cursor with for update statement. And after it, I update the table with "where current of", then it cause the forms hanged up. But In form50 of dp2k, I can run the form successfully.
    The following source code are written in a Key-Next-Item
    Please help me with the problem!!!!!
    declare
    v_cash date;
    v_entno varchar2(16);
    Cursor c1 is
    select proc_date,entno from loan_bank for update;
    begin
    open c1;
    loop
    fetch c1 into v_cash,v_entno;
    exit when c1%NOTFOUND;
    update loan_bank set proc_date=sysdate where current of c1;
    end loop;
    commit;
    close c1;
    show_alert_info('OK! Done to Proc Date');
    end;

    Hello there,
    I'm also facing the same problem...
    Have you found any solution or work-around yet?
    The code i'm using is the following:
    IS
    CURSOR cur_autonum
    IS
    SELECT an_nr + 1
    FROM autonum
    WHERE an_kode ='ADV'
    FOR UPDATE OF an_nr NOWAIT
    RECORD_NOT_FOUND EXCEPTION;
    RECORD_IS_LOCKED EXCEPTION;
    PRAGMA EXCEPTION_INIT(RECORD_IS_LOCKED,-54);
    BEGIN
    OPEN cur_autonum;
    FETCH cur_autonum INTO :ptperson.pe_nr;
    IF cur_autonum%FOUND
    THEN
    UPDATE autonum
    SET an_nr = :ptperson.pe_nr
    WHERE CURRENT OF cur_autonum;
    CLOSE cur_autonum;
    ELSE
         CLOSE cur_autonum;
         RAISE RECORD_NOT_FOUND;
    END IF;
    EXCEPTION
    WHEN RECORD_NOT_FOUND
    THEN
    :global.rc := fnc_alert(118);
    clear_record;
    previous_record;
    RAISE Form_Trigger_Failure;
    WHEN RECORD_IS_LOCKED
    THEN
    IF cur_autonum%ISOPEN
    THEN
    CLOSE cur_autonum;     
    END IF;
    :global.rc := fnc_alert(119);
    clear_record;
    previous_record;
    RAISE Form_Trigger_Failure;
    WHEN OTHERS
    THEN
    IF cur_autonum%ISOPEN
    THEN
    CLOSE cur_autonum;     
    END IF;
    RAISE;
    END;
    greetings,
    Emiel

  • For Update Of &Where current of

    Can you please give answer anyone,What is main use of For update Clause and Where current of Clause?

    When you will want to lock a set of records even before you change them in your program. Oracle offers the FOR UPDATE clause of the SELECT statement to perform this locking.
    When you issue a SELECT...FOR UPDATE statement, the RDBMS automatically obtains exclusive row-level locks on all the rows identified by the SELECT statement, holding the records "for your changes only" as you move through the rows retrieved by the cursor. No one else will be able to change any of these records until you perform a ROLLBACK or a COMMIT.
    The Where Current Of statement allows you to update or delete the record that was last fetched by the cursor.

  • HT4061 My mail will not update and stay current. Its always searching but doesn't do anthing. Any suggestions for ipad3?

    My mail will not update and stay current. Its always searching but doesn't do anthing. Any suggestions for ipad3?

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of this exercise is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login. Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on some Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode.)

  • My ios7 update is frozen an says "preparing for update" and my computerkeeps saying I need to download the newest version of itunes even though I have. What can I do to fix this?

    My ios7 update is frozen an says "preparing for update" and my computerkeeps saying I need to download the newest version of itunes even though I have. What can I do to fix this?

    Go to http://www.apple.com/itunes/download and download the current version.

  • Hey. I have recently made an update on my daughters iMac, particularly update OS X 10.9.4, when finished, its still asking for update and the same update stills remarked in the apple update menu and at the App store app. Why doesn't stop asking f.ud?

    Hey. I have recently made an update on my daughters iMac, particularly the update OS X 10.9.4, when finished, its still asking for update and the same update stills remarked as ready in the apple update menu and remarked as 1 to go at the App store app. Why doesn't stop asking for update when its done like 5 times or more? Thanks for taking your time!

    If you don't already have a current backup, back up all data, then reinstall the OS.* You don't need to erase the startup volume, and you won't need the backup unless something goes wrong. If the system was upgraded from an older version of OS X, you may need the Apple ID and password you used.
    If you use FileVault 2, then before running the Installer you must launch Disk Utility and select the icon of the FileVault startup volume ("Macintosh HD," unless you gave it a different name.) It will be nested below another icon with the same name. Click the Unlock button in the toolbar and enter your login password when prompted. Then quit Disk Utility to be returned to the main Recovery screen.
    There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    If you installed the Java runtime distributed by Apple and still need it, you'll have to reinstall it. The same goes for Xcode. All other data will be preserved.
    *The linked support article refers to OS X 10.9 ("Mavericks"), but the procedure is the same for OS X 10.7 ("Lion") and later.

  • HT4623 When I go into settings and general the option to download ios7 is not there when it then says "checking for updates" and I recieve an error

    When I go into settings and general the option to download ios7 is not there when it then says "checking for updates" and I recieve an error

    What version of iOS is the device currently running?
    In order to update over the air on the device, it must be running iOS5 or higher.

  • Need help for Update and cancel SalesOrder

    Hi All,
    I  written java code for create sales order based on salesquotation,now i want to update and cancel sales order ,i need help to update and cancel salesorder.
    can give any related links for update and cancel salesorder.
    Thanks and Regards,
    Srinivas

    Hi srinivas.L
    It is simple, here is some sample code. You must use getbykey to get the document. Then once you got it you can make whatever changes you need. Then update it. where i have oOrder.Update() you can have oOrder.cancel
    Dim oOrder As SAPbobsCOM.Documents
            oOrder = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
            If oOrder.GetByKey(530) Then
                oOrder.Lines.SetCurrentLine(1)
                oOrder.Lines.WarehouseCode = "01"
                If oOrder.Update() <> 0 Then
                    MsgBox(oCompany.GetLastErrorDescription)
                End If
            Else
                MsgBox("Nothing found")
            End If
    Hope this helps

  • I have installed itunes 10.7 several times.  All goes well.  After reboot, I go into itunes and check for updates and it says I need to download the update 10.7! (And so cant sync with my Iphone)

    I have installed itunes 10.7 several times, all goes well. After reeboot, I go to check for updates and it still wants to update to version 10.7! I cant sync to my iphone4 because I get an error message saying I need version 10.6.3 or later. Help

    Thank you for getting me started on the track by mentioning "Revo" Uninstaller.  The results of "Revo" spoke volumns on why a successful install of ITunes is so difficult to achieve.  It is the evil "BONJOUR".
    I then tripped upon the following site by Apple and the detailed directions (I read, printed, re-read and followed the instructions.  It was intense) brought a successful ITunes, Quick Time and the lovely Bonjour home.  Thank you for the start JD42.
    http://support.apple.com/kb/HT1923

  • Windows Server 2003 R2 Enterprise Edition 32 bits Service Pack 2 never finishes searching for updates and use 100% of CPU.

    Hi everyone, I am having issues updating a clean Windows Server 2003 R2 Enterprise Edition 32 bits Service Pack 2, so any help with be appreciated cause I've already tried all my cards for the past 5 days in this particular issue without success.
    All I did so far is installing Windows Server 2003 R2 Enterprise with Service Pack 2, open IE to update, it keeps searching for updates and never stop, after 20mn to 30mn the process svchost.exe start using 100% of my CPU.
    I already tried the following scenarios:
    1-  Install IE8, install the update KB927891 and the Windows Update Agent 3.0 (I already had this one installed). Reboot and run windows update trough IE8 and the problem did not solved.
    2- Install those 2 software "MicrosoftFixit.wu.MATSKB.Run" and "MicrosoftFixit50777", open IE to update, it still hangs and continues eating my CPU. This is the output of "MicrosoftFixit".
    Windows Update error 0x8007000D(2014-01-06-T-06_06_34A) --> Not Fixed
    Cryptographic service components are not registered (This service is actually running successfully) --> Not Fixed
    3- I found the following script that would register some DLL, deleting the "SoftwareDistribution" and forcing windows update to solve the problem and nothing happened either.
    Link to script:
    http://gallery.technet.microsoft.com/scriptcenter/Dos-Command-Line-Batch-to-fb07b159#content
    Here is a link to the content of my WindowUpdate.log file:
    https://skydrive.live.com/redir?resid=883EE9BE85F9632B%21105
    Thank you in advance for helping.

    All I did so far is installing Windows Server 2003 R2 Enterprise with Service Pack 2, open IE to update, it keeps searching for updates and never stop, after 20mn to 30mn the process svchost.exe start using 100% of my CPU.
    Herein is the root cause of your issue. A topic that's been discussed in several blogs, forums, and even in the media since September regards a known issue with attempting to patch IE6 RTM via Windows Update.
    Aside from that particular issue... browsing the Internet with an unpatched instance of IE6, especially from a Windows Server system, is also asking for a world of hurt.
    Might I suggest the following:
    Download the IE8 for Windows Server 2003 installer to a thumb drive.
    Download the latest Cumulative Security Update for IE8 for Windows Server 2003 to a thumb drive.
    Reinstall Windows Server 2003 with Service Pack 2.
    Upgrade to IE8 from the thumb drive installer and apply the
    Cumulative Security Update.
    Now your machine is capable of safely browsing to Windows Update to install the rest of the updates (well, maybe, there's also all those other Security Updates from the past seven years that your machine still has vulnerabilites for -- even those seven
    years of updates are going to take a Very Long Time to scan for, download, and install).
    Why don't you have a WSUS server? -- noting, wryly, that you've posted in the *WSUS* forum.
    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

  • Found 0 results for Good Morning, I'm all for updates and maintaining, but I'm upset that Googletooolbar is no longer compatible with Mozilla 5 because I had a great amount of sites saved on Google Bookmark and now it is lost. Any suggestions?

    Good Morning, I'm all for updates and maintaining, but I'm upset that Googletoolbar is no longer compatible with Mozilla 5 because I had a great amount of sites saved on Google Bookmark and now it is lost. Any suggestions?

    Hi userwhat,
    Your personal data should have been saved, and you can try to follow these steps to fix your problem.
    *First, you should report that to the developer of the add-on the troubles that you are experiencing.
    * Then, you can try [https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/ The Add-on Compatibility Reporter], which allows you to use add-ons that haven't yet been explicitly updated to work with Firefox 5, and lets you report the results of compatibility.
    * For add-ons that do not work with The Add-on Compatibility Reporter, you can still downgrade to the previously maintained version, which is Firefox 3.6 that you can download here: [http://www.mozilla.com/en-US/firefox/all-older.html http://www.mozilla.com/en-US/firefox/all-older.html]

  • Good Morning, I'm all for updates and maintaining, but I'm upset that Googletooolbar is no longer compatible with Mozilla 5 because I had a great amount of sites saved on Google Bookmark and now it is lost. Any suggestions?

    Good Morning, I'm all for updates and maintaining, but I'm upset that Googletoolbar is no longer compatible with Mozilla 5 because I had a great amount of sites saved on Google Bookmark and now it is lost. Any suggestions?

    Hi userwhat,
    Your personal data should have been saved, and you can try to follow these steps to fix your problem.
    *First, you should report that to the developer of the add-on the troubles that you are experiencing.
    * Then, you can try [https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/ The Add-on Compatibility Reporter], which allows you to use add-ons that haven't yet been explicitly updated to work with Firefox 5, and lets you report the results of compatibility.
    * For add-ons that do not work with The Add-on Compatibility Reporter, you can still downgrade to the previously maintained version, which is Firefox 3.6 that you can download here: [http://www.mozilla.com/en-US/firefox/all-older.html http://www.mozilla.com/en-US/firefox/all-older.html]

  • When playing my ipod on an ipod dock the vocals are very faint. It is fine when doing through the headphones. I am trying to sync for updates and getting the message "An unknown error occured (-1)" - help

    When playing my ipod on an ipod dock the vocals are very faint. It is fine when doing through the headphones. I am trying to sync for updates and getting the message "An unknown error occured (-1)" - help

    Error -1
    Attempt to restore your iOS device two more times. If the issue is still unresolved, the device may need service.
    The "device may need service" means a hardware problem. In that case make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar
    Also see:
    -1 error
    -1 error too

  • Checked for updates and tried to download latest version of itunes but it will not install

    Please help !!!
    I have had itunes installed for years but allof a sudden, when I try to complete an action (create a playlist for example) I get an error message
    "Itunes has stopped working and must close"
    I searched for updates and tried to install the latest vesion of itunes but it will not install - error message just says " failed to install correctly, try reinstalling"
    What has gone wrong and what do I need to do ???
    Fingers crossed

    Solving the iTunes Installation Problems in Windows
    1. Apple has posted their solution here: iTunes 11.1.4 for Windows- Unable to install or open - MSVCR80 issue.
    2. If the Apple article does not fully resolve the problem for you, then try Troubleshooting issues with iTunes for Windows updates - MSVCR80.

  • When firefox checking for updates and updates found but due to proxy restrictions it unable to download the updates then it continue trying to download that and this time it creating problem on running javascript

    When firefox checking for updates and updates found but due to proxy restrictions it unable to download the updates then it continue trying to download that and this time it creating problem on executing javascript and raising errors.

    What are the error messages you are seeing?

Maybe you are looking for