Cursor with for update clause problem

Hi all,
We are having this problem with Oracle 8.1.7 where in we have a cursor with for update clause. The PL/SQL script used to work fine with Oracle 8.0.5 but is causing problems with Oracle 8.1.7. What the script is ending up doing in 8.1.7 is that it updates only one record instead of updating close to 60000 which it used to do in Oracle 8.0.5
The script just hangs after updating one record. We have replicated the same problem.
Has anyone seen this error before and attained resolution?
Thanks

Hello ,
I have found the same / very close to the same problem. I tried the code below in Oracle 10.2.0.1 and got the following error after the first loop.
ORA-01002: fetch out of sequence
ORA-06512: at "DEMO_TEST_RESEARCH_PKG", line 18
ORA-06512: at line 7
After trying to debug it , i thought i would try it in Oracle 9.0.2.0.7.0 , and to my suprise it worked fine.
Am i missing something ? Thanks in advance , ...
I have included the code i was running ...
PROCEDURE WhereCurrentOf(Param1 IN NUMBER) IS
v_title_eng ISSUES.TITLE_ENG%TYPE;
v_issue_id ISSUES.ISSUE_ID%TYPE;
CURSOR issues_cur
IS
SELECT issue_id,title_eng
FROM issues
WHERE title_eng IS NULL
FOR UPDATE OF title_eng;
BEGIN
FOR i IN issues_cur
LOOP
FETCH issues_cur INTO v_issue_id,v_title_eng;
EXIT WHEN issues_cur%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_issue_id||' This was the english title before : '||v_title_eng);
v_title_eng := 'This is my title';
UPDATE issues
SET title_eng = v_title_eng
WHERE CURRENT OF issues_cur;
DBMS_OUTPUT.PUT_LINE(v_issue_id||' This is the english title after : '||v_title_eng);
END LOOP;
END WhereCurrentOf;

Similar Messages

  • How to alter the materialized view defintion with -- For update clause

    My db version is 9.2.0.3
    My orginal materialized view difination does not have "for update " clause.
    how can i alter the mview defination to inclused and exclude the "for update" clause.
    I dont want to drop and recreate the mview with for update clause. But I what to change the existing definition.
    Please suggest.
    Thanks
    Naveen.

    I already have the view definition in place. I want to change the exising defination, by adding the "for update " clause. Is it possible with any " alter mview ... " syntax.
    Below is my existing syntax. I don't what to drop and recreate. Just want to alter the existing definition , with for update clause.
    create materialized view test
    pctfree 0
    tablespace DATA storage (pctincrease 0)
    build immediate refresh start with sysdate next (trunc(sysdate+1) +1/24)
    with primary key
    disable query rewrite
    as select * from test@isource;
    Please suggest!
    Thanks
    Naveen
    Edited by: user12096071 on Apr 8, 2010 2:56 PM

  • ERROR using SQL Server 2000, FOR UPDATE clause problem

    Hi All,
    Because our main target for RDBMS mostly SqlServer2000, I try to use ADF BC with one. I successfully run the BC with Tester, scrolling up and down, BUT when i try to make changes and do commit, I receive ERROR, I have tried both JDBC Driver from Microsoft and jTDS, both FAILS.
    I have set the 'Default Locking Mode ..' to 'optimistic'
    (default is 'pessimistic'), it doesn't help.
    Here is the error :
    With Microsoft JDBC Driver :
    (oracle.jbo.DMLException) JBO-26080: Error while selecting entity for Departments
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer] FOR UPDATE cannot be specified on a READ ONLY cursor.
    With jTDS JDBC Driver :
    (oracle.jbo.DMLException) JBO-26080: Error while selecting entity for Departments
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
    Pls any body help...
    Thank you,
    Krist

    Krist,
    we added a new SQL Flavor 'SQLServer' in JDeveloper 10.1.2
    This was implemented to handle special SQL syntax of SQLServer, different from SQL92 (among others the FOR UPDATE problem you're facing).
    For new projects, you can select this flavor during their creation. For projects that were defined with Flavor SQL92, you can switch to SQLServer at runtime by setting the parameter jbo.SQLBuilder=SQLServer (in your Application Module configuration or as a java option -Djbo.SQLBuilder=...)
    Regards,
    Didier.

  • 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.

  • Cursor have for update clause

    Hi all,
    Can any one please tell me,what is main use of for update cursor.in which case we are using this clause.with simple example can any one please explain.
    Thanks,
    K.venkata Sanjeeva Rao.

    user13483989 wrote:
    Can any one please tell me,what is main use of for update cursor.in which case we are using this clause.with simple example can any one please explain.Where you are looping through data for some reason and want to update the current row.
    Simple example...
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    14 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    cursor cur_emp is
      3      select empno, ename, comm
      4      from emp
      5      for update;
      6  begin
      7    for e in cur_emp
      8    loop
      9      dbms_output.put_line('('||e.empno||') '||e.ename);
    10      if e.comm is null then
    11        update emp
    12        set comm = 0
    13        where current of cur_emp;
    14        dbms_output.put_line('-- Commission reset to 0');
    15      else
    16        dbms_output.put_line('-- Commission: '||e.comm);
    17      end if;
    18    end loop;
    19* end;
    SQL> /
    (7369) SMITH
    -- Commission reset to 0
    (7499) ALLEN
    -- Commission: 300
    (7521) WARD
    -- Commission: 500
    (7566) JONES
    -- Commission reset to 0
    (7654) MARTIN
    -- Commission: 1400
    (7698) BLAKE
    -- Commission reset to 0
    (7782) CLARK
    -- Commission reset to 0
    (7788) SCOTT
    -- Commission reset to 0
    (7839) KING
    -- Commission reset to 0
    (7844) TURNER
    -- Commission: 0
    (7876) ADAMS
    -- Commission reset to 0
    (7900) JAMES
    -- Commission reset to 0
    (7902) FORD
    -- Commission reset to 0
    (7934) MILLER
    -- Commission reset to 0
    PL/SQL procedure successfully completed.
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800          0         20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975          0         20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850          0         30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450          0         10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000          0         20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000          0         10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100          0         20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950          0         30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000          0         20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300          0         10
    14 rows selected.Though, of course this is a pointless example as a simple single update would achieve the same. It's more useful if there are 'other things' you need to do with the data that would exceed the capabilities of just using SQL. Personally I've had little need to use this sort of construct.

  • Getting ORA-22920 Error With 'FOR UPDATE' clause

    Hello all,
    I scanned through all the messages regarding this error and the suggestion posted was to have 'FOR UPDATE' in the SELECT query. I do have that, but I am still getting ORA-22920 (row containing the LOB value is not locked) error.
    I am using JDBC thin driver with 8.0.5. I know the thin driver installation works because I can read data that I inserted using 'INSERT INTO ...' from svrmgr30.
    Can anyone show me some light on this?
    Thanks
    Suresh

    Hi,
    This helped me:
    Before the insert statement:
    connection.setAutoCommit(false);
    ..what you like to do
    at the end..
    connection.commit()
    HTH
    Martin

  • Is there a way to BULK COLLECT with FOR UPDATE and not lock ALL the rows?

    Currently, we fetch a cursor on a few million rows using BULK COLLECT.
    In a FORALL loop, we update the rows.
    What is happening now, is that we run this procedure at the same time, and there is another session running a MERGE statement on the same table, and a DEADLOCK is created between them.
    I'd like to add to the cursor the FOR UPDATE clause, but from what i've read,
    it seems that this will cause ALL the rows in the cursor to become locked.
    This is a problem, as the other session is running MERGE statements on the table every few seconds, and I don't want it to fail with ORA-0054 (resource busy).
    What I would like to know is if there is a way, that only the rows in the
    current bulk will be locked, and all the other rows will be free for updates.
    To reproduce this problem:
    1. Create test table:
    create table TEST_TAB
    ID1 VARCHAR2(20),
    ID2 VARCHAR2(30),
    LAST_MODIFIED DATE
    2. Add rows to test table:
    insert into TEST_TAB (ID1, ID2, LAST_MODIFIED)
    values ('416208000770698', '336015000385349', to_date('15-11-2009 07:14:56', 'dd-mm-yyyy hh24:mi:ss'));
    insert into TEST_TAB (ID1, ID2, LAST_MODIFIED)
    values ('208104922058401', '336015000385349', to_date('15-11-2009 07:11:15', 'dd-mm-yyyy hh24:mi:ss'));
    insert into TEST_TAB (ID1, ID2, LAST_MODIFIED)
    values ('208104000385349', '336015000385349', to_date('15-11-2009 07:15:13', 'dd-mm-yyyy hh24:mi:ss'));
    3. Create test procedure:
    CREATE OR REPLACE PROCEDURE TEST_PROC IS
    TYPE id1_typ is table of TEST_TAB.ID1%TYPE;
    TYPE id2_typ is table of TEST_TAB.ID2%TYPE;
    id1_arr id1_typ;
    id2_arr id2_typ;
    CURSOR My_Crs IS
    SELECT ID1, ID2
    FROM TEST_TAB
    WHERE ID2 = '336015000385349'
    FOR UPDATE;
    BEGIN
    OPEN My_Crs;
    LOOP
    FETCH My_Crs bulk collect
    INTO id1_arr, id2_arr LIMIT 1;
    Forall i in 1 .. id1_arr.COUNT
    UPDATE TEST_TAB
    SET LAST_MODIFIED = SYSDATE
    where ID2 = id2_arr(i)
    and ID1 = id1_arr(i);
    dbms_lock.sleep(15);
    EXIT WHEN My_Crs%NOTFOUND;
    END LOOP;
    CLOSE My_Crs;
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20000,
    'Test Update ' || SQLCODE || ' ' || SQLERRM);
    END TEST_PROC;
    4. Create another procedure to check if table rows are locked:
    create or replace procedure check_record_locked(p_id in TEST_TAB.ID1%type) is
    cursor c is
    select 'dummy'
    from TEST_TAB
    WHERE ID2 = '336015000385349'
    and ID1 = p_id
    for update nowait;
    e_resource_busy exception;
    pragma exception_init(e_resource_busy, -54);
    begin
    open c;
    close c;
    dbms_output.put_line('Record ' || to_char(p_id) || ' is not locked.');
    rollback;
    exception
    when e_resource_busy then
    dbms_output.put_line('Record ' || to_char(p_id) || ' is locked.');
    end check_record_locked;
    5. in one session, run the procedure TEST_PROC.
    6. While it's running, in another session, run this block:
    begin
    check_record_locked('208104922058401');
    check_record_locked('416208000770698');
    check_record_locked('208104000385349');
    end;
    7. you will see that all records are identified as locked.
    Is there a way that only 1 row will be locked, and the other 2 will be unlocked?
    Thanks,
    Yoni.

    I don't have database access on weekends (look at it as a template)
    suppose you
    create table help_iot
    (bucket number,
    id1    varchar2(20),
    constraint help_iot_pk primary key (bucket,id1)
    organization index;not very sure about the create table syntax above.
    declare
      maximal_bucket number := 10000; -- will update few hundred rows at a time if you must update few million rows
      the_sysdate date := sysdate;
    begin
      truncate table help_iot;
      insert into help_iot
      select ntile(maximal_bucket) over (order by id1) bucket,id1
        from test_tab
       where id2 = '336015000385349';
      for i in 1 .. maximal_bucket
      loop
        select id1,id2,last_modified
          from test_tab
         where id2 = '336015000385349'
           and id1 in (select id1
                         from help_iot
                        where bucket = i
           for update of last_modified;
        update test_tab
           set last_modified = the_sysdate
         where id2 = '336015000385349'
           and id1 in (select id1
                         from help_iot
                        where bucket = i
        commit;
        dbms_lock.sleep(15);
      end loop;
    end;Regards
    Etbin
    introduced the_sysdate if last_modified must be the same for all updated rows
    Edited by: Etbin on 29.11.2009 16:48

  • 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

  • Working with FOR UPDATE

    Hi,
    i have 2 session(A, B) and trying to execute sql statement with For update clause
    Session A
    select * from emp where empid in (10) for update nowait;
    Session B
    select * from emp where empid in (10, 20) for update nowait;
    my question is after executing select statement in sessin B will oracle locks
    empid =20 or it will ignore the lock as part of it (empid=10) is already locked by
    session A.
    Can anyone plz help me in this..
    Rds,
    Naga

    Why not try it out?:
    Session A:
    SQL> select empno,ename from emp where empno in (7788) for update nowait;
         EMPNO ENAME
          7788 SCOTTSession B:
    SQL> select * from emp where empno in (7788,7900) for update nowait;
    select * from emp where empno in (7788,7900) for update nowait
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specifiedSesson A again:
    SQL> select empno,ename from emp where empno in (7900) for update nowait;
         EMPNO ENAME
          7900 JAMES

  • Form4.5 For update clause in cursor problem

    Hi,
    I am putting this code in my forms4.5 pl/sql block and get the error when compile the pl/sql block.
    "Encountered ";" when expecting "of".....
    Code is:
    Select null INTO dummy from mytable
    where id = 1456
    for update nowait;
    If I remove for update clause it compiles ok.
    So can anyone tell me what's going on here...
    thx

    Actually I used...
    For update of column_name and it worked.
    I have another problem which I am posting here in a new thread.
    thx

  • ADF and MSSQL 2005 problems - FOR UPDATE clause allowed only for DECLARE C

    Hi all.
    I have a legacy application which uses MS SQL server 2000 / 2005. I've started to build up a new version of this application using JDev + ADF stack.
    Everything went ok until I've tried to update some data in a Form. I'm getting this error:
    com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR
    Can someone figure out what's wrong?
    1) In a MSSQL server connection string, normally we define the 'SelectMethod' parameter to 'cursor', as follows: jdbc:sqlserver://$host$:$port$;databaseName=dbserver;SelectMethod=cursor
    Since I was not able to do this through my project's 'Application Resources > Connections' screen, I could not evaluate if this is the cause
    2) I'm trying to follow the steps of an Oracle tutorial (http://www.oracle.com/technology/obe/obe11jdev/ps1/ria_application/developriaapplication_long.htm#ad), of course using MS SQL server instead of Oracle, and using some master->detail tables like the example suggests (in the tutorial, I've reached the step 11, then tried to update a record, which causes the mentioned exception)
    Follows the stacktrace:
    <Utils><buildFacesMessage> ADF: Adding the following JSF error message: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
    com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
         at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
         at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMoreResults(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.seekToOutParams(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getPrepStmtHandle(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
         at oracle.jbo.server.BaseSQLBuilderImpl.doEntitySelectForAltKey(BaseSQLBuilderImpl.java:707)
         at oracle.jbo.server.BaseSQLBuilderImpl.doEntitySelect(BaseSQLBuilderImpl.java:546)
         at oracle.jbo.server.EntityImpl.doSelect(EntityImpl.java:7789)
    Regards,
    Luciano S. Lorencini, SCJP, SCWCD

    So, I`ve created a test project and use the MSSQL flavor to create my Business Components.
    After repeated all the steps, the error did not happen again.
    But some strange behavior happen: I change some data and click the "Submit" button. The changed data appears ok in screen, but the changes were not committed in database!
    Do I need to explicitly tell ADF to commit that changes somewhere?
    Greetings,
    Luciano S. Lorencini, SCJP, SCWCD

  • RE: for update clause

    Hi,
    If you are using Forte as 2-tier tools, there shouldn't be any problem in
    using select ... for update. The sql is actually passed through to your
    back-end database. So everything should work the same, provided that every
    user has his own database session ( like by using DBResourceMgr to create
    DBSession at run-time for each user. )
    However, if you are building multi-tier application, there is no simple
    answer to your question. The problem is common to all 3-tier application
    since the application / database layer is shared among many users. If you
    start a transaction from client side, use select ... for update to lock a
    record, allow user to change data, then update and end the transaction, you
    are not just locking up a record, but also a database session. In such
    model, you will run out of DBSession very soon.
    What we did here is to use a "lock count", which exists is every table.
    When client retrieves a record, it won't start a transaction there. A
    transaction is started only on the server and after client commits its
    changes to the server. Data consistency is checked by checking the lock
    count in the update where clause.
    It looks dumb, but it's the only solution that we can reach after consulting
    a lot of white paper and Forte consultants. Moreover, Forte consultant also
    said its bad to start a transaction on client side.
    I do hope that there is a better solution out there in handling 3-tier
    applications too. Afterall, this lock count thing is clumsy.
    Peter Sham.
    -----Original Message-----
    From: Phong Tran [SMTP:[email protected]]
    Sent: Thursday, March 18, 1999 6:50 AM
    To: [email protected]
    Subject: for update clause
    dear forte-users,
    I notice the "for update" clause can only used with cursor.
    Just wonder why you can not use it with "sql select ...." statement.
    Also as I understand it, one way to protect the data consistency is
    through
    the mutex lock but then you turn the object to a single-threaded to
    serialize access even though you access different rows in a
    database
    table. The fact is you only want access on a particular row.
    Does anyone know the best way to lock a row (or rows) in the
    database ?
    If you have to rely on the "for update" clause in the cursor
    definition for
    the locking, then you almost end up with a lot of cursors.
    Example: the method ReadnWriteDB(ordeId) accesses a specific row
    but since the orderOBj serializes access, other tasks have to wait.
    OrderObj: OrderMgr = new(IsShared = TRUE, IsTransactional = TRUE);
    method GetOrderInfo() of the TransactionSO.
    begin transaction
    OrderObj.ReadnWriteDB(orderId);
    end transaction;
    From Client:
    Begin
    start task TransactionSO.GetOrderInfo(orderId);
    end;
    Phong
    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/>

    Which application front end are you using.
    Also, you'll get the same error if your Query runs too long, and/or your rollbacks are too small.

  • For update clause

    Hi all
    in cursor with select for update clause we can reference column list. like
    select.......
    from....
    for update [of column_reference]
    I want to know that what is the use of specifying column nane in for update clause?
    because its main purpose is to lock rows before update or delete, and complete row will be locked not only that column, then what is the use of mentioning it.
    Secondly, I want to know that when we perform dml then automatically locks occur, then why we use for update clause.???
    third,
    when locks occur, when we open cursor or when update or delete???

    If you've got FireFox, you can add tahiti.oracle.com and asktom.oracle.com to the list of search engines you have available in the upper right-hand corner. I can't tell you how addicted I am to that little piece of heaven.
    Justin

  • About for update clause

    hi, i want to lock some rows that i've selected in a program. so, i use a for update clause. Here is my query:
    SELECT *
    FROM (
         SELECT name, age, classe, average
         FROM student
         WHERE average >= '15'
         AND warning is NULL
         AND status = '1'
         ORDER BY age
         FOR UPDATE OF average)
    WHERE ROWNUM <= 5
    the problem is that the oracle server always return this message:
    ORA-00907: Parenthèse de droite absente
    May you tell me what's wrong with this query? according to the Oracle message, it seems that i don't close a bracket,but it is not the case.So what it is the problem?
    thanks.

    It seems that you cannot have a FOR UPDATE clause in a inline view and that you cannot use the FOR UPDATE clause for an inlinve view if the inline view has an ORDER BY clause.
    One solution is to create a temporary table to store the rowids of the table your want to select for update.
    Example:
    create global temporary table student5
    ( orowid rowid )
    on commit preserve rows;
    insert into student5
    select rowid
    from (select rowid
    from student
    where average >= 15
    and warning is null
    and status = '1'
    order by age)
    where rownum <= 5;
    select * from student where rowid in (select orowid from student5) for update;Note also that if student.average column is numeric, you should not use quotes for '15'.

  • How to avoid 'for update' clause ?

    Hi All,
    I am trying to build the data-entry form based on complex view. I've got JBO-26080 Error while selecting entity...
    (ORA-02014 select ... for update).
    Is it possible to delete 'for update' clause in select ?
    What is the best practice to deal with data-entry form for many View Objects ?

    I believe the "for update" is issued because of your locking mode. (It's probably jbo.lock.mode in the app-module configuration?)
    If lock-mode is pessimistic then a for-update should be issued right away; if it's optimistic it'll be issued as part of the commit process (the lock isn't held for very long!); it it's "none" it won't be issued at all.
    HTH
    Mike.

Maybe you are looking for