RE: Close cursor to release lock?

Hi,
I don't think you will need to release the cursor before the update,
otherwise the cursor will be rendered useless.
Regards,
Peter Sham.
-----Original Message-----
From: Phong Tran [SMTP:[email protected]]
Sent: Monday, March 22, 1999 12:49 PM
To: [email protected]
Subject:
Dear fellow users,
Following is a simple code showing the use of cursor "cCursor"
which
contains clause "for update of col_name". The RDBMS used is SQL
SERVER 6.5.
The "sql open cursor cCursor ..." supposes to lock the row for
update.
Since ODBC does not support positioned update with clause "where
current
of cCursor", I am not sure if you have to close the cursor to
release the
lock before updating with the "sql update ..." statement within the
same
transaction, or no need to close it before issue the satement.
Any helps 'd be appreciated.
Regards
Phong
cursor definition for CustCursor:
select c_balance,c_ytd_payment, c_delivery_cnt ,
from customer
where c_id = :cId and c_d_id = :cDId and c_w_id = :cWId
for update of c_balance, c_delivery_cnt
begin transaction
cCursor: CustCursor;
sql open cursor cCursor(custObj.c_id, dId, wID) on session
DBConnect;
sql fetch cursor cCursor into :custObj;
// update c_balance, c_delivery_cnt in customer using
custObj.
// can update while the cursor lock is on this curtomer.
// ODBC does not support positioned update.
// close cursor first then update.
sql close cursor cCursor;
sql update customer set c_balance = :custObj.c_balance,
where c_id = :custObj.c_id AND c_d_id = :dId AND c_w_id =
:wId
on session DBCOnnect;
end transaction;
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

Hi Mohit,
check this thread if you want to release lock in web ui by coding..
Transaction in Edit mode - Unlock transaction
Hope this helps..
Cheers,
Sumit Mittal

Similar Messages

  • ORA-00060: deadlock detected while waiting for resource CLOSE cursor

    Hi,
    I am a new member of this forum. I am working with a problem we got a few weeks ago. It is from a Pro C batch executable running on 10 threads dealing with >800 data accessed from multiple tables. The error as reported came from a package.function call.
    This is the error I encountered:
    process_item~G****, D***~-60~ORA-00060: deadlock detected while waiting for resource~PACKAGE ERROR = CLOSE cursor C_***** in package R***.I*** 7641
    The cursor is a simple SELECT cursor without Table or Record locking.
    My questions are:
    *Upon the occurrence of this error, is the execution already at the CLOSE cursor line or did the error occurred between the OPEN cursor and the CLOSE cursor? There are several lines of code in between OPEN and CLOSE:
    - one that calls for a package.function that simply stores parameter values to a variable
    - another one which fetches the cursor. The group that holds the cursor values is only used by a single function in the package
    *Is it possible for this CLOSE cursor to cause a deadlock? What could have caused this?
    *From what I know, Oracle deals with deadlocks by aborting the deadlocking process while others continue, but this deadlock caused our program to hang. How is this possible? Could the root cause of the deadlock be from our threading program? This is a rare occurrence and happened only twice this year.
    Thanks,
    Raf

    Raf Serrano wrote:
    Hi,
    I am a new member of this forum. I am working with a problem we got a few weeks ago. It is from a Pro C batch executable running on 10 threads dealing with >800 data accessed from multiple tables. The error as reported came from a package.function call.
    This is the error I encountered:
    process_item~G****, D***~-60~ORA-00060: deadlock detected while waiting for resource~PACKAGE ERROR = CLOSE cursor C_***** in package R***.I*** 7641
    The cursor is a simple SELECT cursor without Table or Record locking.
    My questions are:
    *Upon the occurrence of this error, is the execution already at the CLOSE cursor line or did the error occurred between the OPEN cursor and the CLOSE cursor? There are several lines of code in between OPEN and CLOSE:
    - one that calls for a package.function that simply stores parameter values to a variable
    - another one which fetches the cursor. The group that holds the cursor values is only used by a single function in the package
    *Is it possible for this CLOSE cursor to cause a deadlock? What could have caused this?
    *From what I know, Oracle deals with deadlocks by aborting the deadlocking process while others continue, but this deadlock caused our program to hang. How is this possible? Could the root cause of the deadlock be from our threading program? This is a rare occurrence and happened only twice this year.
    Thanks,
    RafSELECT (without FOR UPDATE) statements are never involved in ORA-00060.
    only DML statements throw ORA-00060 error

  • Releasing lock on closing NWBC

    Hi..
    I am locking a object when it is edited, when i close the browser i am able to release lock on the object.
    But the same lock is not released when i close the NWBC without saving.
    How to handle this in webdynpro whenthe application is exited abnormally in case of NWBC.
    Please give  your valuable inputs.
    thanks
    Vimal.

    Same problem here with he.net, my ISP. Apple's iPhone Mail.app has a clear bug here. I am unable to check my mail from my desktop for near 5 minutes or so after accessing it on the iPhone. Very annoying.

  • Function module to hold and release lock on MARD table entry

    Hi Gurus,
    Can you please tell me Function module to HOLD lock on MARD table and the Function Module to release lock on MARD table entry.
    Thanks and Regards,
    Sudipto

    Look via SE11 lock objects, use F4 for tables MAR*, the best for your request is on MARC table with object EMMARCS, so use FM ENQUEUE_EMMARCS and DEQUEUE_EMMARCS.
    Regards,
    Raymond

  • Cannot Release Lock error while Importing mdl file?

    Hi,
    I am trying to import an mdl file in the test enviroment from the development environment.
    No users are working on test environment.
    I start importing the mdl file.
    Then I got the error as "Cannot Release lock:.
    I checked that, no sessions are active and no one is using parallely the owb for testenviroment.
    Could anyone explain, why this error came?
    Thank you,
    Regards,
    Gowtham Sen.

    Did the instance go down whilst doing this?
    Is there more to the log before where you started it?
    Cheers
    David

  • How to close siri from the lock-screen in ios 7.1??

    How to close siri from the lock-screen in ios 7.1??
    Some times when I place something on the phone siri start woking and the phone get hot fast and the battery is dead faster than normal.

    Sorry, that cannot be changed.

  • URGENT : Releasing locks aquired after the session ubruptly terminated

    Hi everybody,
    When a record is edited the record gets locked.
    If the session is ubruptly terminated (PC switched off, Network down or something like that) before the edited record is commited or rolled back and if the same record is accessed after loging on once agian "Cannot reserve record " message is displayed.
    When will such locks get released?
    Is there any way to make the record editable (releasing locks programatically)?
    Thanks
    Brijesh

    The old session should clean up given time - How, depends of course if this is a Client Server Form or a Web Deployed Form.
    If it is a web deployed form then the FORMS60_TIMEOUT (or FORMS90_TIMEOUT) will be used to determine how long to wait before cleaning up the process and releasing the locks.
    If this is client server then it's a database configuration thing.
    There is no way to manually release the locks of an orphaned session in code. The DBMS_LOCK package does have a way of releasing a lock, but I think this is only locks that have been taken out by dbms_lock itself, not a "normal" lock.

  • How to release lock for TP?

    Hi,
    can any one pls tell me how to release lock for TP

    Hey Raja
    Can you be more specific of what is TP?
    Btw, there is a transaction called SM12 where we can lock unlock entries of table or transactions. Check if that can help.
    Kind Regards
    Eswar

  • Pr& po -new release strategy? released/locked/incomplete

    Dear MM experts,
    I would like to understand what it is meaning of
    released
    locked
    incomplete
    while doing assignment of object class thru cl24n for new release strategies,
    I am clear on released & locked, I would like to understand what is "incomplete" means as per SAP.
    kindly clarify
    thanks in advance
    srihari

    Incomplete means - When you go to CL02 or CT04
    you are entering the statu for calss or char as locked or released
    but when you are creating and that time if you have keep the status is in preparation  and without changing the status you start maintainig the data in CL24N than you will see the statu as incomplete.

  • Oracle select for update: not releasing lock

    My JDBC code uses "select for update" to modify record in Oracle database. I tried to simulate network connection down situation.
    After my JDBC code locked on a record using "select for update", I unplugged the network cable. I then tried to run the same code on another computer, but it could not accquire the lock, because the previous lock was not released. I tried sqlplus to lock the record, but failed also. The lock has been there for at least an hour now. I guess it may finally be released, but is there a way for oracle to release the lock as soon as the connection is down? Not know if it is a JDBC setting or oracle setting.

    Dear Friend,
    What you are trying to do is not correct way of checking the concurrency and transaction.
    The reason is as listed below.
    01.Always remember http is a stateless protocol and removing the connection or just closing the browser will never be informed to the database or to the application server thus the transaction monitor (TM)or processor will never release the lock as it will deem that the actor is manipulating the data.
    02.As per locking goes every database is having a �TM� and the default isolation level setting is different like oracle uses serializable DB2udb 7.0 or db2/As400 uses repeatable read. You can change this setting by editing the default setting in the database but be very sure before touching it.
    03.     You can also transpose this with your Application server setting for that piece of code or Globally but again be very sure about it as it will change the entire gamete.
    04.     For releasing lock you have to manually do it or you can change the settings of App server or the Database to release the connection after some wait time.
    Regards,
    Ruchir

  • Find close cursor in database

    Hi,
    DBA has told us that there are 200 open cursors in database and this number is growing everyday.
    how to find out which places developers have forgotten to use "Close Cursor" in code.
    Thanks
    Sandy

    thanks it was useful information. is there a way to find out which procedures are the culprit.If you (or your DBA) are talking about v$open_cursor...
    Oracle caches cursors. What you see in this view are not just pl/sql Cursor For Loops but any kind of cursor. Even a plain old select statement "select * from dual;" will show up here.
    And when a cursor is closed/completed it does not immediately disappear from this view. It may remain in the cache (and in this view) until a slot is needed for a new cursor. Who knows how long that may take...
    Yes, it's possible you may have a bad procedure that isn't doing a proper close of an explicit cursor. But you (or your DBA) should do some research on this view before chasing after something that may not even exist.

  • COMMIT Without Releasing Lock

    Is it possible to keep on locking tables after COMMIT is
    executed?
    I am now writing a batch program to TRUNCATE and INSERT records
    into a working table, which is locked exclusively at the
    beginning. A COMMIT is executed after a fixed number of records
    is inserted (and the last INSERT, of course). However, I
    remember COMMIT will also release lock on the working table.
    The problem is that I wish to keep the exclusive lock on the
    working table until the end of the program. This is because I
    need to further process the working table's contents, which are
    supposed to be "freezed" until the end.
    How can I do that?

    you can try using the dbms_lock package to create your own lock,
    this way you can choose to not automatically release the lock
    when you commit.
    I never used it, but in the oracle documentation you should find
    more information about how to use this package.

  • Release Locks - SM12 - DEQUEUE

    I would like to programmatically be able to release locks from SM12. I will potentially have locks set on lock object ERSPLS_LOCK (table RSPLS_S_LOCK). I know majority of you will say this is bad practice, but I really have a business need for this, and would like to avoid the lengthy explanation.
    I found the function module DEQUEUE_ERSPLS_LOCK which seems to be created for this purpose, but I cannot figure it out. Can anyone please explain the settings, or supply another FM or program that can release locks based on a certain InfoProvider?
    Here are the Function Module selection options with their defaults:
    MODE_RSPLS_S_LOCK    Default to 'E'
    MANDT                Default to '10' (client)
    INFOPROV            
    GUID                
    SEQNO             Default to '000' (unsure about this)  
    LINE                
    X_INFOPROV          
    X_GUID              
    X_SEQNO             
    X_LINE              
    _SCOPE         Default to '3' (allows function and program to release lock)     
    _SYNCHRON           
    _COLLECT            
    I have locks in SM12 with the following similar criteria:
    Table: RSPLS_S_LOCK
    Lock Argument: 010GLPFCST                      4989B89EB53D0057...... (about 128 characters long, only the first 10 are similar with the rest)
    Lock Object Name: ERSPLS_LOCK
    InfoProvider: GLPFCST
    Any insight on what settings to use to release these locks from this function module?
    Thanks!

    Hi,
    Ccheck the below link:
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/c025bbf011d140bdb22b196208817e/frameset.htm
    Reg
    Pra

  • Release lock record

    hi everybody,
    i want to know how can i release lock record? is there any setting in application server to do this?
    thanks a lot

    Hi
    Please give some more information as your question does not seem to be complete.
    Are you talking about Operating system lock or database lock .
    Please provide the correct release you are currently using .
    Regards
    Sadiq

  • OracleDataReader.Close() needed to release Open Cursors

    I noticed that if I follow the idiom for using OracleDataReader as given in the examples that accompany ODP, it is not good enough for cleaning up.
    For example, all the examples provided use something like this:
    try
    con.Open();
    rdr = cmd.ExecuteReader();
    ...do stuff with rdr
    finally
    cmd.Dispose();
    con.Close();
    con.Dispose();
    But that's not good enough. If I do this 20 times, I get 20 identical open cursors.
    If, however, the finally block is coded like this,
    finally
    rdr.Close();
    rdr.Dispose();
    cmd.Dispose();
    con.Close();
    con.Dispose();
    Then there are NO open cursors after this is all over with.
    For Oracle people: Is this the intended behavior?
    For everyone else: Where you aware you needed to do this to clean up?
    I didn't know to do this since none of the examples do this.
    If it turns out this is best practice for ODP, I recommend the examples be updated to do this.
    If I'm misunderstanding something, then someone please educate me.
    Thanks,
    David Kreth Allen
    Carlson School of Management
    University of Minnesota

    I tend to explicitly call Dispose() but certainly using a "using" block is another option. Well, OK, sometimes for a quick and dirty example I may not do it, but in general I consider it a good practice. I don't want objects to hang around in the finalization queue waiting to be GC'ed for example...
    For more discussion around Dispose() as well as Close() there is this thread:
    Why call .Close() and .Dispose() on a connection.
    - Mark

Maybe you are looking for

  • Problem in passing values from AS to Java

    Hi, I am using Remote Object(Flex 3) for passing the data between java and flex. I am using the BlazeDS as the bridge. I have to pass an array collection containing value objects to the java method. I have created the value object in both the client

  • Pour some light on 0906 infotype Additional Data for Correspondence

    Hi Experts, I have now explored a infotype 0906 - Additional Data for Correspondence. hope its fetch my requirement regarding correspondence letter related to HR ( Appointment, Transfer letter etc) Please can u suggest how this infotype works and whi

  • MI default client change

    hi We have installed MI 7.0 and want to assign java part to client other than 001. There is no specific procedure given to MI like XI for changing default production client. We checked Sap Note 937323 and 940309. Kindly guide us on the following quer

  • IDOCS and Functional DOCS?

    Hi SAP Guru's, I am a SAP FI Functional consultant. I recently got a project and they want me to write Functional documents and know about IDOCS. Could you please explain these two documents in detail? How are they different from each other? How to w

  • HELP! Please with Airport Extreme

    I bought an Airport Extreme in July when I also bought my MB Pro. I finally got my CPU room done and want to hook it up tonight and after 2hrs, it still doesn't work. The LED continuously flashes yellow, which is suppose to mean no connection or sign