Deadlocks with simple UPDATE statement

I have in a C# program a dictionary and in SQL Server a stored procedure with a simple UPDATE statement. I process the dictionary in parallel. For each entry in my dictionary I call this stored procedure and I am getting deadlocks.
This is the UPDATE statement:
ALTER PROCEDURE [dbo].[UpdateImages]
@ICRTCode nvarchar(max),
@ICRTImage nvarchar(max)
AS
BEGIN
UPDATE Images SET processed = '1', Image = @ICRTImage, ProcessDate = GETDATE() WHERE IDICRT = @ICRTCode
END
Can someone give me a hint as to why this would cause deadlocks? There are no other processes writing to this table. This is a table in a staging database.

http://blogs.msdn.com/bartd/archive/2006/09/09/747119.aspx
http://blogs.msdn.com/bartd/archive/2006/09/25/770928.aspx
Try change the statement a little bit
UPDATE Images SET processed = '1', Image = @ICRTImage, ProcessDate = GETDATE()
FROM
Images
WITH (TABLOCK) WHERE IDICRT = @ICRTCode
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • Update multiple columns with single update statement..

    HI all,
    i am reading the columns value from different table but i want to update it with signle update statement..
    such as how to update multiple columns (50 columns) of table with single update statement .. is there any sql statement available i know it how to do with pl/sql..

    As I understood, may be this. Here i am updating ename,sal, comm columns all at once.
    SQL> select * from emp where empno=7369;
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17/12/1980 12:00:00        800                    20
    SQL> UPDATE emp
      2     SET ename = lower (ename),
      3         sal = sal + 1000,
      4         comm = 100
      5   WHERE empno = 7369;
    1 row updated.
    SQL> select * from emp where empno=7369;
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7369 smith      CLERK           7902 17/12/1980 12:00:00       1800        100         20
    SQL> UPDATE emp
      2     SET ename = (SELECT 'ABCD' FROM DUAL),
      3         sal = (SELECT 1000 FROM DUAL),
      4         comm = (SELECT 100 FROM DUAL)
      5   WHERE empno = 7369;
    1 row updated.

  • Help with this update statement..

    Hi everyone,
    I am trying to update a column in a table .I need to update that column
    with a function that takes patient_nbr and type_x column values as a parameter.
    That table has almost "300,000" records. It is taking long time to complete
    almost 60 min to 90 min.
    Is it usual to take that much time to update that many records?
    I dont know why it is taking this much time.Please help with this update statement.
    select get_partner_id(SUBSTR(patient_nbr,1,9),type_x) partner_id from test_load;
    (it is just taking 20 - 30 sec)
    I am sure that it is not the problem with my function.
    I tried the following update and merge statements .Please correct me if i am wrong
    in the syntax and give me some suggestions how can i make the update statement fast.
    update test_load set partner_id = get_partner_id(SUBSTR(patient_nbr,1,9),type_x);
    merge into test_load a
    using (select patient_nbr,type_x from test_load) b
    on (a.patient_nbr = b.patient_nbr)
    when matched
    then
    update
    set a.partner_id = get_partner_id(SUBSTR(b.patient_nbr,1,9),b.type_x);
    there is a index on patient_nbr column
    and the statistics are gathered on this table.

    Hi Justin,
    As requested here are the explain plans for my update statements.Please correct if i am doing anything wrong.
    update test_load set partner_id = get_partner_id(SUBSTR(patient_nbr,1,9),type_x);
    "PLAN_TABLE_OUTPUT"
    "Plan hash value: 3793814442"
    "| Id  | Operation          | Name             | Rows  | Bytes | Cost (%CPU)| Time     |"
    "|   0 | UPDATE STATEMENT   |                  |   274K|  4552K|  1488   (1)| 00:00:18 |"
    "|   1 |  UPDATE            |        TEST_LOAD |       |       |            |          |"
    "|   2 |   TABLE ACCESS FULL|        TEST_LOAD |   274K|  4552K|  1488   (1)| 00:00:18 |"
    merge into test_load a
    using (select patient_nbr,type_x from test_load) b
    on (a.patient_nbr = b.patient_nbr)
    when matched
    then
    update
    set a.partner_id = get_partner_id(SUBSTR(b.patient_nbr,1,9),b.type_x);
    "PLAN_TABLE_OUTPUT"
    "Plan hash value: 1188928691"
    "| Id  | Operation            | Name             | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |"
    "|   0 | MERGE STATEMENT      |                  |   274K|  3213K|       |  6660   (1)| 00:01:20 |"
    "|   1 |  MERGE               |        TEST_LOAD |       |       |       |            |          |"
    "|   2 |   VIEW               |                  |       |       |       |            |          |"
    "|*  3 |    HASH JOIN         |                  |   274K|    43M|  7232K|  6660   (1)| 00:01:20 |"
    "|   4 |     TABLE ACCESS FULL|        TEST_LOAD |   274K|  4017K|       |  1482   (1)| 00:00:18 |"
    "|   5 |     TABLE ACCESS FULL|        TEST_LOAD |   274K|    40M|       |  1496   (2)| 00:00:18 |"
    "Predicate Information (identified by operation id):"
    "   3 - access("A"."patient_nbr"="patient_nbr")"Please give some suggestions..
    what's the best approach for doing the updates for huge tables?
    Thanks

  • What is wrong with this update statement

    Hi all,
    I am trying to create a simple update program that allows user to enter table name, key fields and one field to update and its value.
    But report goes into dump at update statement?
    Here is the code:
    REPORT  ZTABLE_UPDATE.
    parameters: tabname(18).
    PARAMETERS: key1(15),"use at where condition
                key1val(20),
                key2(15),"use at where condition
                key2val(20),
                field2(15)."field to be updated
    PARAMETERS: yenideg1(20),
                yenideg2(20).
    CONDENSE: tabname, field2,
              yenideg1, yenideg2,
              key1val, key2val,
              key1, key2.
    data: wa like tabname.
    *update (tabname) SET field2 = yenideg1*
                     *WHERE key1 like key1val and key2 like key2val.*if sy-subrc eq 0.
      SELECT SINGLE * FROM (tabname) INTO wa
                      WHERE key1 like key1val
                        and key2 like key2val.
        WRITE / wa. "to test whether replacement is ok.
    endif.
    Thanks in advance.
    Deniz

    Hi:
    follows is ok:
    DATA: dy_table TYPE REF TO data,
          dy_line  TYPE REF TO data,
          ifc TYPE lvc_t_fcat,
          xfc TYPE lvc_s_fcat.
    DATA: it_clrs_fields LIKE TABLE OF dfies WITH HEADER LINE.
    DATA: cond(72) TYPE c,
          itab LIKE TABLE OF cond,
          itab2 LIKE TABLE OF cond.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                 <dyn_wa>,
                 <dyn_field>,
                 <fs>.
    PARAMETERS: tabname TYPE ddobjname OBLIGATORY.
    PARAMETERS: key1(15) OBLIGATORY,"use at where condition
                key1val(20) OBLIGATORY,
                key2(15),"use at where condition
                key2val(20),
                field2(15)."field to be updated
    PARAMETERS: yenideg1(20),
                yenideg2(20).
    ***START
    CONDENSE: tabname, field2,
              yenideg1, yenideg2,
              key1val, key2val,
              key1, key2.
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
      EXPORTING
        tabname              = tabname
    TABLES
       dfies_tab            = it_clrs_fields[]
      FIXED_VALUES         =
    EXCEPTIONS
       not_found            = 1
       internal_error       = 2
       OTHERS               = 3
    LOOP AT  it_clrs_fields .
      MOVE-CORRESPONDING it_clrs_fields TO xfc.
      APPEND xfc TO ifc.
      CLEAR: xfc.
    ENDLOOP.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = ifc
      IMPORTING
        ep_table        = dy_table.
    ASSIGN dy_table->* TO <dyn_table>.
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    ASSIGN dy_line->* TO <dyn_wa>.
    CLEAR COND.
    CONCATENATE key1 ' = ''' key1val '''' 'AND' INTO cond.
    APPEND cond TO itab.
    CLEAR COND.
    CONCATENATE key2 ' = ''' key2val '''' INTO cond.
    APPEND cond TO itab.
    SELECT  *
      INTO <dyn_wa>
      FROM (tabname)
       WHERE (itab).
    ENDSELECT.
    IF sy-subrc <> 0.
      WRITE / 'no this data in dbtab'.
      EXIT.
    ENDIF.
    CLEAR COND.
    CONCATENATE field2 ' = ''' yenideg1 '''' INTO cond.
    UPDATE (tabname) SET (cond)
                    WHERE (itab).
    IF sy-subrc EQ 0.
      SELECT SINGLE * FROM (tabname) INTO <dyn_wa>
                      WHERE (itab).
    WRITE / <dyn_wa>. "to test whether replacement is ok.
    ENDIF.
    you alse can use:
    FM: VIEW_MAINTENANCE_CALL can used to do table maintenance.
    note:
    1.to do Table Maintenance Generator.
    2.be authorized to to use tansaction sm30.
    好运,
    启明星

  • Need a simple  UPDATE statement for updating areas of the polygons

    Hi,
    I need a simple UPDATE SQL statement for updating areas of the polygons in a table shema.table (geom) with sdo_area function.
    Dejan

    Dejan,
    Maybe I don't understand your question but I will offer this:
    update SOME_TABLE t set t.areasqft = SDO_GEOM.SDO_AREA(GEOM, 0.005) where t.geom.GET_GTYPE() = 3
    This assumes a "feet" based SRID.
    r,
    dennis
    Edited by: user633187 on Dec 1, 2008 9:04 AM

  • Deadlocks due to update statements

    hi, we perform update statements as follows in the example below, with several threads each one mapping on a different connection as:
    // THREAD operations
    UPDATE table SET field=ThreadID WHERE field=default_value
    COMMIT;
    RESULTSET = SELECT pKey FROM table WHERE field=ThreadID;
    ... operations
    // LOOP ON RESULTSET
    WHILE RESULTSET.NEXT() NOT NULL;
    UPDATE table SET field=default_Value WHERE PKEY=pKey;
    COMMIT;
    END WHILE;
    // END LOOP
    // END THREAD
    Is a deadlock situation possible? Could this depend on particular settings of the configuration or connection?
    Thanks a lot for the answers
    null

    hi aco,
    deadlocks are possible only when you update a row (A)and not commit it and try to update a another row (B), and another process is trying to update row (B) and not commit and update row(A), so each process endup waiting for the other to release locks.
    normally oracle does not let deadlocks in the database, if it detects deadlocks it rollbacks the statments itself with an error message.
    since you seem to be commiting after an update there should not be a deadlock. unfortunately there are no settable parameters for lock issues. it is upto your application to prevent deadlocks. unless you use the facilities dbms_lock package or explicitly define your own locking mechanism for your application, you need not worry much about the deadlocks.
    Mukundan.

  • Simple Update statement is taking too much time

    Hi,
    I have following update statement which is taking approx. 1 hour to update 4 lacs records. there is no any where clause in this statement and no any index on the updating column. there are only two indexes except primary key which are on other columns.
    update cp_t_exception set module_cd='DEFAULT';
    Please suggest me what can be the reason of this slowness?
    Regards,
    Sachin

    914014 wrote:
    Hi,
    please see the following details-
    Database Version -
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    Execution Plan -
    PLAN_TABLE_OUTPUT
    Plan hash value: 2176582109
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | UPDATE STATEMENT | | 422K| 3298K| 31637 (1)| 00:06:20 |
    | 1 | UPDATE | CP_T_EXCEPTION | | | | |
    | 2 | TABLE ACCESS FULL| CP_T_EXCEPTION | 422K| 3298K| 31637 (1)| 00:06:20 |
    Regards,
    SachinThanks Sachin.
    I have certain suggestions for your situation: Please see which you like the most and can be implemented
    _1. Modify the Update Statement_
    Add the Complementary Set condition in the Where Predicate, thus eliminating the set of records that need not be updated.
    viz.
      update table table_name set column_name = 'DEFAULT' where column_name != 'DEFAULT';_2. Parallel Queries_
    Check if your Software supports Parallel Query Execution. Also read the Parallel Hint for DML and Parallel_Index Hint.
    _3. Create Table As Select (This option wouldn't really be required for such small amount of data.)_
    You can create a New Table and drop the existing table.
    a. Create a New Table new_table as select column_1.. columnN, decode(status, 'DEFAULT', 'DEFAULT', 'DEFAULT') from base_table; -- No Logging Mode
    b. Build the Index, Triggers, Constraints.
    c. Alter the table to LOGGING.
    d. Drop the Base_table; -- Verify if the entire data in New_Table is same as Base_Table.
    e. Rename the New_table to base_table.
    Check the Suggestions 1 and 2 to compare the performance with the DML without using them. Let us know if you still face same problem.

  • HELP! With parsing Update statement

    I am stuck and need help! The teacher has not gone over parsing with us and it is not on his scheduled topics list. But, I am a person that likes to scope out and learn new things. For our final project, we have to allow updates, delete and inserts into the 5 main tables of the Premiere Products database. I have done everything except for the updates. I can achieve the updates of the entities by pretty much hardcoding them and that is okay by the teacher, but I want to learn about parsing because Barbara from this site mentioned this to me.
    This is what I was able to write and I am getting errors:
    CREATE OR REPLACE PROCEDURE updatecust_proc (
    v_cust_num IN customera.cust_num%TYPE,
    v_attributetoupdate VARCHAR2 ,
    v_updatedvalue VARCHAR2 )
    AS
    e_invalidcustnum_error EXCEPTION;
    BEGIN
    v_isvalidcustnum := iscust(v_cust_num);
    IF (v_isvalidcustnum = FALSE) THEN
    RAISE e_invalidcustnum_error;
    END IF;
    PARSE(
    'UPDATE customer
    SET' &#0124; &#0124; v_attributetoupdate &#0124; &#0124; '=' &#0124; &#0124; v_updatedvalue &#0124; &#0124;
    'WHERE cust_num =' &#0124; &#0124; v_cust_num
    END;
    EXCEPTION
    WHEN e_invalidcustnum_error THEN
    DBMS_OUTPUT.PUT_LINE('Cannot be updated. Invalid customer number');
    END;
    Any help would be useful. I went to the Oracle help site but their examples are a little too complicated for me to understand, plus, I am not using any C code.
    Thanks in advance!
    Bob

    I will try putting in spaces to the areas that you mentioned to me. Thanks!
    I will try to explain the function just in case some other poeple don't understand what I am trying to do.
    This procedure is supposed to update the CUSTOMER entity. This entity has 7 attributes and I don't want to write out 7 UPDATE statements to changes a value. Instead, I want the name of the attribute to be passed to the proceudre so that the UPDATE statement can know which attribute to use. Barbara mentioned something about parsing and I attempted to try it out, but I am getting errors. Can someone help me with the procedure. BTW, function iscust() returns TRUE if the customer number is valid, otherwise, it returns false.
    Thanks,
    Bob

  • Problem with CFQUERY update statement

    I'm having trouble getting an SQL Update statement to work
    correctly and I'm scratching my head as to why.
    The output i get is the following:
    Syntax error in UPDATE statement
    SQLSTATE 42000
    SQL UPDATE companies SET CompanyName = 'Insight Data Ltd',
    Address1 = '5 Boulevard', Address2 = '', Address3 = '', City =
    'Weston-super-Mare', County = 'North Somerset', Postcode =
    'BS231NN', OfficeBranch = 'BR', contacttitle1 = 'Mr', contactname1
    = 'Andrew', contactsurname1 = 'Scott', contactposition1 = 'Owner',
    mail1 = 'yes', TelNumber = '01934 123456', TPS = 'no', FaxNumber =
    '',FPS = 'no',MobileNumber = '',MPS = 'no',email =
    '[email protected]', EPS = 'no', WebAddress = '
    http://www.insightdata.co.uk',
    contacttitle2 = 'Mr', contactname2 = 'David', contactsurname2 =
    'Lewis', contactposition2 = 'Office Manager', mail2 = 'no',
    contacttitle3 = 'Mr', contactname3 = '', contactsurname3 = '',
    contactposition3 = 'Owner', mail3 = 'no', contacttitle4 = 'Mr',
    contactname4 = '', contactsurname4 = '', contactposition4 =
    'Owner', mail4 = 'no', wPVCUfab = 'yes', wALUinst = 'yes', WHERE
    companyid = 33415
    VENDORERRORCODE -3503
    DATASOURCE idv6
    I've checked that all the data fields are in the correct
    format, and I can't see why I am getting a syntax error. Any help
    on this would be appriciated

    Agreed, but it looks like you already have the sql. Take the
    query from the error message above and run it in your database.
    Though I did notice have an extra comma between the last column and
    there WHERE clause.
    wALUinst = 'yes' , WHERE companyid = 33415
    For the optional columns, put the commas first to prevent
    errors due to trailing or too many commas
    UPDATE Table
    SET Column1 = 'value'
    <cfif SomeValueExists>, Column2 = 'other value'
    </cfif>
    WHERE ID = 123
    Two other things to consider: use cfqueryparam and consider
    normalizing your table. Column names like Contact1, Contact2,
    Contact3 ... are usually a sign its time to normalize.

  • IC won't update with simple ABAP statements

    Hi,
    I am trying to analyze an update rule. The standard rule has all the IF and ELSE statements, so I took them out. I then put only theses statement
          RESULT = COMM_STRUCTURE-DLV_QTY.
          RETURNCODE = 0.
      ABORT = 0.
    For some reason the IC will not update. I check the PSA and RSA3, and there are values for this field DLV_QTY.
    What else should I do to check why the IC wouldn't update?
    Thanks

    Hi,
    in the request monitor, select a datapackage, right click on it and select simulate update. In the following popup you can select what to debug, UR or TR as well as the no. of records to be used for debugging.
    Just Try by Hard Coding in your Update Routine with BREAK-POINT.
    1. Find the Activated Program which you can in the Update rules -> Extras -> Activated Program will give you the activated program. Go to SE38 and display the program and place a soft break-point in the program from where you want to Debug.
    2. Go to the monitor, load the data using the psa. Once Loaded go into the details tab of the monitor (Right Hand Side) and right click on the Datapackage and click on Simulate update.
    3. In the new screen, click on the update rules and activate debugging in update rules and click on simulation which ill take u into the program press F8 until u get the Break-point which you would have placed.
    There are two methods of debugging update routines.
    1. Debugging with Soft break point
    2. Debugging with Hard break points
    1. If you are in production envirnoment and client is not modifiable, it is not possible to hard code 'Break-Point' statement in the update routine. So you need to load data in PSA and from monitor need to go to processing of data package and then you can select routine which is to be debugged from the debuge window 'overview' tab.
    2. Debugging with Hard break points is insertion of break-point statement in the code prior to the statement where debugging is to be started. Rest procedure remains same as explain above.
    It is important to remove break point statement once debugging is over . Else it will give short dumps while loading data in foreground.
    Regards,
    Hareesh

  • Incrementing with an update statement in MySQL

    Hi,
    Disclaimer: I'm very new to this whole thing.
    I have a very simple DB, one with names in it and one with a numberOfTimesAccessed. As you'd imagine, each time a name is accessed I want to increment the associated numberOfTimesAccessed field. Is there a way to do this, without first getting what was in the numberOfTimesAccessed field before? Is this overcomplicating things?
    Thanks in advance,
    elmicko

    for example, if you have columns name, numberOfTimesAccessed in table access_log,
    try (for updating name='foobar')
    UPDATE access_log SET numberOfTimesAccessed=numberOfTimesAccessed+1 WHERE id='foobar';hope this helps

  • Simple update statement problem

    hello experts sorry to bother everyone with such a mundane question but this is giving me a headache
    i have 2 table ike and ike2
    ike has c1, c2 and ike2 has c_1 and c_2
    i like to set c2 on ike = to sysdate when c1=C_1
    UPDATE (SELECT c1,c2,c_1, c_2 FROM ike , ike2  WHERE c1 = c_1 )
      SET ike.C2 = sysdate ;
    this seems really simple todo yet im having a hell of a time getting this to work can anyone point out the obvious.
    Please

    Hi,
    Let me make sure I understand.
    Some rows in ike have matching rows in ike2; that is ike.c1 = ike2.c_1.
    For those rows that have matches, you want to set ike.c2 to SYSDATE.
    For the rows the don't have a match, you don't want to change anything.
    Is that it?
    If you wanted to change all the rows, you would just say:
    UPDATE  ike
    SET     c2 = SYSDATE;If you only want to update some of the rows in ike, you add a WHERE clause at the end.
    Either an EXISTS or an IN sub-query would make a good condition. Here's how to use IN:
    UPDATE  ike
    SET     c2 = SYSDATE;
    WHERE   c1  IN ( SELECT  c_1
                     FROM    ike2
                   );

  • Java.lang.NullPointerException with and update statement

    Hello,
    I'm getting this exception:
    java.lang.NullPointerException
         phaseone.AlbumModel.updateImageTrackerAlbums(AlbumModel.java:313)
         phaseone.AlbumModel.processRequest(AlbumModel.java:228)
         phaseone.AlbumModel.doGet(AlbumModel.java:522)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    I have an open method called before this one that connects me to the database. It works fine and have it working with a bunch of other methods but this one gives me this exception. i've even hard coded the variable 'user' and 'albumNumber' with information that exists in the database. i can't see where this logical error is coming from. I appreciate the help. I've been on this for 3 1/2 hour going blind. thanks!!
    public boolean updateImageTrackerAlbums(String user, int albumNumber){
              PreparedStatement pstmt = null;
              boolean pass = false;
              String query = "update imagetracker set totalalbums = ? where username = ?";
              try{
              pstmt = conn.prepareStatement(query);
              pstmt.setInt(1, albumNumber);
              pstmt.setString(2, user);
             int x = pstmt.executeUpdate();
             if (x >= 1){
             pass = true;
              }catch(SQLException e){
                e.printStackTrace();
                return pass;
              }finally{
              DBUtil.closePreparedStatment(pstmt);
              return pass;
              }

    code3 wrote:
    The exception is pointing to this:
    pstmt = conn.prepareStatement(query);
    Do you understand anyway when a NullPointerException would be thrown? It will be thrown if you try to access/invoke an object reference which is actually null.
    Connection conn = null;
    pstmt = conn.prepareStatement(query); // Throws NPE because conn is null.

  • PL/SQL cursor with FOR UPDATE STATEMENT

    Welcome,
    I have some troubles with cursors. When I try update values in table using cursor i receive ORA-01410 Error : "INVALID ROWID".
    I use code as below:
    ALTER SESSION SET CURRENT_SCHEMA=TEST_SCHEMA;
    DECLARE
    TYPE LogTable_typ IS TABLE OF ADMIN_FILE_LOG%ROWTYPE;
    v_ModuleId KTIMS.ADMIN_FILE_LOG.MODULE_ID%TYPE;
    v_CDR KTIMS.ADMIN_FILE_LOG.CDR_SUCCESS%TYPE;
    CURSOR c1 IS
    SELECT MODULE_ID, cdr_success FROM ADMIN_FILE_LOG
    FOR UPDATE OF CDR_SUCCESS NOWAIT;
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_ModuleId,v_CDR;
    IF v_ModuleId = 'LOAD' THEN
    UPDATE ADMIN_FILE_LOG SET CDR_SUCCESS = 70 WHERE CURRENT OF c1;
    END IF;
    EXIT WHEN c1%NOTFOUND;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLERRM || SQLCODE);
    END;
    When I use ROWID in cursor declaration all works fine.Working code is:
    ALTER SESSION SET CURRENT_SCHEMA=KTIMS;
    DECLARE
    TYPE LogTable_typ IS TABLE OF ADMIN_FILE_LOG%ROWTYPE;
    v_ModuleId KTIMS.ADMIN_FILE_LOG.MODULE_ID%TYPE;
    v_CDR KTIMS.ADMIN_FILE_LOG.CDR_SUCCESS%TYPE;
    v_id ROWID;
    CURSOR c1 IS
    SELECT MODULE_ID, cdr_success, ROWID FROM ADMIN_FILE_LOG
    FOR UPDATE OF CDR_SUCCESS NOWAIT;
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_ModuleId,v_CDR,v_id;
    IF v_ModuleId = 'LOAD' THEN
    UPDATE ADMIN_FILE_LOG SET CDR_SUCCESS = 70 WHERE ROWID = v_id;
    END IF;
    EXIT WHEN c1%NOTFOUND;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLERRM || SQLCODE);
    END;
    What is difference in this two cases ?
    I try to find this in Oracle documentation "Database PL/SQL User's Guide and Reference" ( http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#i45288 ).
    Please help.

    Hi,
    I think the USE of NOWAIT clause in cursor for update is, to remove the lock immediately after the transaction is over.
    In the second example where you are fetching the rowid explicitly and use the same id in loop to make the update, so there should not be any problem in this case.
    In the first example when you are using CURRENT OF to do the update, it is basically work on basis of latest fetched row from cursor and do the update (but i think implicitly it use the reference of row id also).
    I am not sure about it , but still try once by removing the NOWAIT clause from your cursor for update and try once , see whether you are still facing the error or not.

  • Help with simple INSERT statement?

    How can I do an insert into Oracle without having to
    specify EVERY field name in the table? This isn't necessary
    with Access or
    SQL Server, which will insert null's in the non-specified
    fields, the Oracle SQL
    tool tells me that there aren't enough field values when I run
    this SQL Statement:
    INSERT INTO TABLE_NAME VALUES (1234, 'test', 'test')
    There are over 10 different fields, but I get the error message:
    Native Error Code 947, Not enough values.
    TIA
    Kris
    null

    Kristofer Goss (guest) wrote:
    : How can I do an insert into Oracle without having to
    : specify EVERY field name in the table? This isn't necessary
    : with Access or
    : SQL Server, which will insert null's in the non-specified
    : fields, the Oracle SQL
    : tool tells me that there aren't enough field values when I run
    : this SQL Statement:
    : INSERT INTO TABLE_NAME VALUES (1234, 'test', 'test')
    : There are over 10 different fields, but I get the error
    message:
    : Native Error Code 947, Not enough values.
    : TIA
    : Kris
    You may omit the columns list, but if you do then the VALUES
    clause must provide values for every column in the table.
    FOR EXAMPLE: if your table were created as follows:
    COLUMN_1 NOT NULL, VARCHAR2(4)
    COLUMN_2 NUMBER(6)
    COLUMN_3 DATE
    COLUMN_4 VARCHAR2(4)
    You could submit a statement like:
    insert into my_table VALUES ('ALLA', , , 'XYZ');
    You could also submit a statement like:
    insert into my_table (column_1, column_4) VALUES ('ALLA', 'XYZ');
    If you do not want to store any value in a particular column,
    then that column must be allowed to accept NULLs.
    Hope this helps.
    null

Maybe you are looking for

  • Troubles saving PDF Files

    Error states The document could not be saved.  The file may be read-only, or another user may  have it open.  This goes on in every document for all administrators in the office, even when we know no one has it opened.  This didn't happen until we st

  • How to manage large database records in enterprise application

    Hi All, I am working on a large enterprise application relating to Capital Market. I am working in Java and with its extended technology. I am facing one critical problem which needs solution from your side. I have a database table which contains app

  • Safari won't recognize adobe reader plug-in

    I just purchased a macbook pro and have installed the adobe reader plug-in. Each time that I try to load the same page it directs me to download the plug-in. Where am I going wrong?

  • I have an Object of unknown type. How to run it's method?

    I have an Object, I dont't know it's type, and I want to run method, the name of which I know. How can I do this? Please help. Thank you!

  • Help on confirmations and Invoice

    Hi friends How to create invoice and confirmations locally Regards krishna