Problem combining select, order by, rownum (top-N) and for update

Hello,
i have serious problems with this.
-- drop table testtable;
create table testTable (id number(10,0) primary key, usage number(10,10));
-- delete from testtable;
insert into testtable values (11, 0.5);
insert into testtable values (10, 0.3);
insert into testtable values (12, 0.3);
insert into testtable values (9, 0.3);
insert into testtable values (8, 0.9);
insert into testtable values (3, 0.0);
insert into testtable values (2, 0.02);
insert into testtable values (1, 0.05);
insert into testtable values (7, 0.7);
insert into testtable values (6, 0.4);
insert into testtable values (5, 0.2);
insert into testtable values (4, 0.1);
select * from testtable;
-- without FOR UPDATE
select * from (
select tt.id id_, tt.*
from testtable tt
where tt.usage > 0.1
order by tt.usage desc, tt.id desc
where rownum <= 10;
--> WORKS
-- without ORDER BY
select * from (
select tt.id id_, tt.*
from testtable tt
where tt.usage > 0.1
where rownum <= 10
for update of id_;
--> WORKS
-- without WHERE ROWNUM <= 10
select * from (
select tt.id id_, tt.*
from testtable tt
where tt.usage > 0.1
order by tt.usage desc, tt.id desc
for update of id_;
--> WORKS
-- But what i need is this:
select * from (
select tt.id id_, tt.*
from testtable tt
where tt.usage > 0.1
order by tt.usage desc, tt.id desc
where rownum <= 10
for update;
--> ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc., SQL State: 42000, Error Code: 2014
select * from (
select tt.id id_, tt.*
from testtable tt
where tt.usage > 0.1
order by tt.usage desc, tt.id desc
where rownum <= 10
for update of id_;
--> ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc., SQL State: 42000, Error Code: 2014
I have tried every single solution i could come up with.
But nothing worked.
My latest idea is to include a comment in the query and set up an ON SELECT trigger which evaluates the comment and enforeces the lock.
But i'm not sure if this is even possible.
I cannot split the statement into two because i need the lock immediately when the wanted rows are selected.
One major criteria for the rows is the order by. Without it i get a random set of rows.
And the rownum <= 10 is also needed because i don't want to lock the whole table but only the few needed rows.
I tried row_number() over (order by ...) but this is considdered a window/group-function which disallows the for update as well as the order by.
During these tests i noticed, that when using the row_number()-function the resultset is ordered automatically (without an additional order by clause).
But this doesn't help anyway.
I tried using piped functions to wrap the select to apply the rownum manually by cursor skip, but this doesn't work either. First of all i wasn't able to wrap the query the way i imagined and second the lock would be applied to the whole resultset anyway but only the reduced rows would be returned.
I heared about LOCK-hints from other DBs, is there anything similar here?
Any other solution??
btw. it has to be high-performance after all.
Greetings Finomosec;

No, not perfect.
This is the expected result (ordered by usage desc, id desc):
ID     USAGE
8     0.9
7     0.7
11     0.5
6     0.4
12     0.3
10     0.3
9     0.3
5     0.2
This ist the one produced by your statement:
ID     USAGE
5     0.2
6     0.4
7     0.7
8     0.9
9     0.3
10     0.3
11     0.5
12     0.3
Use limit 5 in your tests, and you will also notice that the following doesn't work either:
select * from testtable ww where ww.id in
select id from
select tt.id, tt.usage
from testtable tt
where tt.usage > 0.1
where rownum <= 5
order by usage desc, id desc
for update;
It's because the order is not applied to the result.
But the following modification works (at least principally):
select * from testtable ww where ww.id in
select id from
select tt.id, tt.usage
from testtable tt
where tt.usage > 0.1
order by usage desc, id desc
where rownum <= 5
order by usage desc, id desc
for update;
Thr problem here is:
I need to expand the following Statement to the above form by (Java-) Code:
-- statement-A
select tt.id, tt.usage
from testtable tt
where tt.usage > 0.1
order by usage desc, id desc;
The main problem is:
The order by clause needs to be duplicated.
The problem here is, to identify it (if present) and NOT any order by in inner selects.
I am using Hibernate and to implement this i have to modify the OracleDialect to solve this problem. I get the statement-A (see above) and have to apply the limit.
Isn't there any other solution??
Greetings Finomosec;

Similar Messages

  • Problem combining selection tools in Photoshop CC 2014

    When I make a selection using the Quick Selection Tool in Photoshop CC and then switch to the Lasso Tool to refine the selection, it just adds to what I already had selected.  If I do the same thing in CC 2014, as soon as I click on the photo with the Lasso Tool the original selection disappears. 

    Look at your selection options in the tool options bar for the lasso tool.
    Sounds like cc is set to Add and cc2014 is set to New
    You could just keep the option on new and use the shift key to add to the selection.
    more info:
    Photoshop Help | Selecting with the lasso tools
    Photoshop Help | Default keyboard shortcuts

  • Im having midi problems, im using a TASCAM US-2000 interface and for some reason logic wont pic it up even though its saying its the default??? help!!! i am running the latest an newest iMac...

    need help working this out..

    "It won't pick it up even though it says it's the default..."
    You checked this how? Where does it "say" it is the default?

  • VPD problem: select for update on join tables with policy on ref table

    In our application we use VPD. Now we ran into an issue. I will try to explain with EMP and DEPT table.
    EMP table has no VPD attached.
    DEPT table has VPD policy that forbids all updates, but allows select. (Policy returns '1=2' for statement type update.
    This query returns no rows:
    select * from emp join dept using (department_id) for update. This makes sense, because I'm going to update both the tables.
    However:
    select * from emp join dept using (department_id) for update of employee_id also returns no rows. THIS IS WRONG. I'm not going to update dept table.
    Any experience with this. Is this a known limitation ?

    I can see all the rows, because there is no select policy.
    However the point is, that VPD should allow me to update the emp table, because there is no update policy.
    With the 'for update of employee_id' clause, VPD should recognize that I'm not going to update the dept table, but only the emp table. But VPD does not recognize this, but applies the update policy of dept to the statement, making the statement to update no rows.
    (Reason behind my question is ADF Business Components, where you have ViewObjects with Referenced Entities. ADF BC generates this type of statement and now we run into this VDP limitation)

  • Top 5 and Bottom 5

    Hi all ,
    Can anyone help me in solving the following problem ..
    How to get top 5 and bottom 5 selling books in a single query
    Eg:
    Book name No.sold
    A 45
    B 78
    C 8
    D 6
    T 66
    E 33
    AA 35
    AB 95
    AC 51
    AD 5
    AE 42
    desired output :
    Top 5 bname | bottom 5 bname
    AB AD
    B D
    T C
    AC E
    A AA
    Thanks in advance
    Sana

    Since, in general, more than one book can have same no_sold, more than 5 books can have top/bottom no_sold. If you want all 5 top and bottom selling books, use:
    with t as (
               select  book_name,
                       no_sold,
                       dense_rank() over (order by no_sold desc) rnk_top,
                       dense_rank() over (order by no_sold) rnk_bottom,
                       row_number() over (order by no_sold desc) rn_top,
                       row_number() over (order by no_sold) rn_bottom
                 from  books
    select  t1.book_name,
            t2.book_name,
            t1.no_sold top_no_sold,
            t2.no_sold bottom_no_sold,
            nvl(t1.rnk_top,t2.rnk_bottom) rank
      from      t t1
            full join
                t t2
              on (
                      t2.rn_bottom = t1.rn_top
      where t1.rnk_top <= 5
        and t2.rnk_bottom <= 5
      order by nvl(t1.rn_top,t2.rn_bottom)
    BO BO TOP_NO_SOLD BOTTOM_NO_SOLD       RANK
    AB AD          95              5          1
    B  D           78              6          2
    T  C           66              8          3
    AC E           51             33          4
    A  AA          45             35          5
    SQL> If all you want is any 5 top/bottom sold books:
    with t as (
               select  book_name,
                       no_sold,
                       row_number() over (order by no_sold desc) rn_top,
                       row_number() over (order by no_sold) rn_bottom
                 from  books
    select  t1.book_name,
            t2.book_name,
            t1.no_sold top_no_sold,
            t2.no_sold bottom_no_sold,
            t1.rn_top rn
      from      t t1
            inner join
                t t2
              on (
                      t1.rn_top <= 5
                  and
                      t2.rn_bottom <= 5
                  and
                      t2.rn_bottom = t1.rn_top
      order by rn
    BO BO TOP_NO_SOLD BOTTOM_NO_SOLD         RN
    AB AD          95              5          1
    B  D           78              6          2
    T  C           66              8          3
    AC E           51             33          4
    A  AA          45             35          5
    SQL> SY.

  • [Forms6]Select for update before update and commit

    Hi,
    In the KEY-COMMIT forms trigger
    My code finds the primary keys of the rows to be updated,
    then there is "select ...where "these keys".. for update nowait"
    then there is a commit
    (There also is a pragma exception init -54 "Resource Busy")
    At runtime I get an error:
    "Cannot insert rows here".
    Maybe I should lock these rows before triggering the Key-commit?
    --> message edited
    Oops, I just reproduced the code in Forms 10,
    I select for update from emp where empno=7839 then update King's sal then commit_form;
    and everything works fine.
    So I have to locate where this error message comes from.
    --< End of edit
    Many thanks for your help.
    Edited by: JeanParis on Dec 23, 2009 10:31 PM

    Hi,
    The issue is solved on my Developer 2000 10 installed on Windows XP.
    At work on Forms 6 I have hidden the warning with a :system.message_level.
    What I'm searching now is a script to check the locks in the situation where
    I don't have access to the catblock.sql script because I'm not DBA on the database. (but I can see DBA_LOCKS).
    The problem starts because on the master block there is an item that can ben changed
    from 'CREAT' to 'VALID', and in the When Validate Item trigger on that item I cannot issue a go_block( 'xxx' ).
    I have to go to the 'xxx' block in order to start a first record - next loop to gather values and update a table accordingly.
    Many thanks for your care.
    JBM.

  • Select for update

    Hi,
    I have some problem.
    I think to use 'for update' clause for exclusive-data-lock.
    I tested in development environment, my program execute well.
    When I distribute my program, the problem is occur!
    I locked row. Another can lock same row. Because DBSession is connect to Oracle
    by only one session. oracle think that connected user is one, it is enable to
    lock same row.
    Someone give me good advice to lock row by oracle.
    And I want to know the way to exclusive-data-lock in forte standerd.
    Thanks.
    &#27;$B3t<02q<R&#27;(B &#27;$B%F%#!<!&%7!<!&%(%U&#27;(B
    &#27;$B!!!!!!;3ED&#27;(B &#27;$B8y&#27;(B([email protected])
    T.C.F.Co.Ltd.
    Isao Yamada([email protected])

    Tom,
    Instead of selecting the timestamp ahead of time, why not just include it
    in your update statement?
    ... where timeStamp <= :timeStamp
    If the update fails, it will return 0 rows, at which time you can do
    whatever exception processing you want to do.
    Don
    At 06:22 PM 9/25/97 +0800, Tom wrote:
    Dear folks,
    We're also studying how to handle concurrency in our project, including
    method of timestamp and object id. But we decide to use db resources and
    let the database handle the locking for us as timestamp method will
    incur a double data retrieval/IO, and an unique object id will
    bottleneck the system.
    Any comments on it, pls let me know.
    Cheers :-)
    Ivan Chung.
    Dale V. Georg wrote:
    On Fri, 12 Sep 1997 09:45:34 -0500, Schiek, Labeaux wrote:
    Hi Isao:
    I had the same problem, So let me start by saying thefollowing;
    This is a non-trivial task.
    Unfortunately, I'm in an environment which 'has no money' to
    purchase these excellent tools, so I'm forced to create my own.
    So here is a very rudimentry way of handling concurrancy
    Given that there is a unique id in each row of the DB table.
    Create an array of Textdata or IntegerData in your database
    service object(DBSO).
    When someone attempts a 'Select ....... for Update' request
    through the DBSO, it first checks the array to see if someone elsehas
    'checked it out'.
    If yes, then send a message saying 'this record is checkedout'
    if no , then append the unique id to the array and perform the
    SQL statement.
    When the update is performed through the DBSO, then deletethen
    Unique ID from the Array.
    There are a other few checks in these methods to keep things
    clean.
    I call this ' The Poor Man's Concurrancy Handler', but hey, so
    far it works for me. We have a low number of concurrent users(normally
    les than 10).
    No doubt, this method of attack is frought with futureproblems,
    but if you don't make mistakes, you not learning. :-)
    If you need further detail on what I've done, let me know andI
    will supply you with more info.
    And if others wish to comment on this way to handleconcurrancy
    (positive or negitive) - feel free!What we have done is another form of "poor-man's concurrency." We
    added a timestamp column to the tables of our database where we wanted
    to implement row-level locking, then added a DateTimeData attribute to
    the corresponding business object. Whenever a user selects rows, we
    load the timestamp value into the business object. If later on they
    go
    to save changes to that object, we first select the timestamp for the
    row from Oracle with intent to update. We then verify that the
    timestamp in the database matches the one in their object and if so,
    allow them to perform the update, including an update of the timestamp
    column. Otherwise we send an error message back to tell them that
    someone else has updated the database since they did their original
    select. This way the row is only locked during the brief period that
    it is actually being updated. (Note that this approach is marginally
    easier on Microsoft SQL Server than on Oracle since MS-SQL gives you a
    timestamp column that it automatically maintains.)
    Several people recommended this type of approach in this forum a few
    months back, and it has worked out well for us. In reality, we've
    never actually bumped into a conflict; it's just not the nature of the
    application I'm currently involved with to have multiple people
    potentially updating the same objects. Nevertheless, it's good to
    have
    SOMETHING there to handle those "what if" cases.
    Dale
    ====================================
    Don Nelson
    Senior Consultant
    Forte Software, Inc.
    Denver, CO
    Corporate voice mail: 510-986-3810
    aka: [email protected]
    ====================================
    "If you ask me, though, any game without push-ups, hits, burns or noogies
    is a sissy game." - Calvin

  • ORA-01002-Error in Select ... for update

    I would like to insert CLOB in a table (VP_EVENTS) with a primary key (eventid) with the following code:
    String content = "AAAAAAAAAAAAABBBBBBBBBBXXX";
    PreparedStatement cs = this.con.prepareStatement("INSERT INTO vp_events (eventid,term,participant)
    VALUES (?,?,empty_clob())");
    //Register IN-Parameter
    cs.setInt(1, 1);
    cs.setInt(2, 1);
    cs.setTimestamp(3, new java.sql.Timestamp( System.currentTimeMillis() ));
    //Execute statement
    cs.execute();
    cs.close();
    Statement stmt = con.createStatement();
    ResultSet clobLocatorSet = stmt.executeQuery( "SELECT PARTICIPANT FROM VP_EVENTS WHERE EVENTID=1 FOR UPDATE");
    // Get the CLOB-locator
    if (clobLocatorSet.next())
    oracle.sql.CLOB clob =
    ((oracle.jdbc.driver.OracleResultSet)
    clobLocatorSet).getCLOB(1);
    // Write CLOB-Data
    // The first parameter to plsql_write, is // the offset from which to start
    // writing, and the second parameter is the // data to be written.
    // plsql_length(), returns the length of // the data in the CLOB column
    countCLOB = clob.plsql_write(
    0,content.toCharArray());
    At the execution-point of the "Select for Update"-statement the oracle thin driver throws the Error "Fetch out of sequence ORA-01002".
    What's wrong?

    Connection conn = DriverManager.getConnection ("jdbc racle:thin:@myhost:1521:ORCL","scott", "tiger");
    conn.setAutoCommit(false);
    Statement stmt = conn.createStatement ();
    null

  • LOB: Select for update

    I keep getting this error with some pretty standard CLOB code to update data:
    HELLLP!!!
    SQLException: ORA-01002: fetch out of sequence
    java.sql.SQLException: ORA-01002: fetch out of sequence
    Here's the code:
    CLOB lob_loc = null;
    String buf = new String ("CLOB text buffer test");
    Connection myConn=
    DriverManager.getConnection("jdbc:oracle:thin:@172.16.11.32:1521:ORCL","outerforce","outerforce");
    Statement stmt = myConn.createStatement();
    System.out.println("BEFORE SELECT FOR UPDATE........");
    ResultSet myResultSet = stmt.executeQuery("SELECT data FROM clobtest WHERE assign_no=7 FOR UPDATE");
    System.out.println("SELECT DONE FOR UPDATE........");
    if (myResultSet.next())
    lob_loc = ((OracleResultSet)myResultSet).getCLOB (1);
    OracleCallableStatement cstmt = (OracleCallableStatement)
    myConn.prepareCall ("BEGIN DBMS_LOB.OPEN(?, DBMS_LOB.LOB_READWRITE); END;");
    cstmt.setCLOB(1, lob_loc);
    cstmt.execute();
    /* if (myResultSet != null){
    while (myResultSet.next()) {
    System.out.println(myResultSet.getString("assign_no"));
    long pos = 0; // This is the offset within the CLOB where the data is to be written
    long length = 0; // This is the size of the buffer to be written.
    // This loop writes the buffer three times consecutively:
    //for (int i = 0; i < 3; i++)
    // Fill the buffer with some data to be written:
    length = buf.length();
    //pos += length;
    // This is an Oracle-specific method:
    //lob_loc.plsql_write(pos, buf.toCharArray());
    lob_loc.putString(pos, buf);
    //}

    Sorry Email reply was incorrect
    send to:
    [email protected]
    null

  • Select for update query not working..

    hi i am tying to get this bit of ncode to work so i can then go to the next part of demonstrating a deadlock between two transactions. however i cannot go any further has my initial code does not work at all. here it goes
    //////////User A////////////////////////////////
    DECLARE
    v_salary squad.salary%TYPE := 300;
    v_pos squad.position%TYPE := 'Forward';
    BEGIN
    UPDATE squad
    SET salary = salary + v_salary
    WHERE sname = 'Henry';
    FOR UPDATE;
    UPDATE squad
    SET position = v_pos
    WHERE sname = 'Fabregas';
    COMMIT;
    END;
    //////////////////////User B/////////////
    DECLARE
    v_salary squad.salary%TYPE := 200;
    v_pos squad.position%TYPE := 'Forward';
    BEGIN
    UPDATE squad
    SET position = v_pos
    WHERE sname = 'Fabregas';
    FOR UPDATE;
    UPDATE squad
    SET salary = salary + v_salary
    WHERE sname = 'Henry';
    FOR UPDATE;
    COMMIT;
    END;
    Basicly user a creats a lock and so does user b, user b enquires a lock from user a and vice versa i.e. a deadlock

    Hi
    You get the following error:
    ORA-06550: line 8, column 7:
    PLS-00103: Encountered the symbol "UPDATE" when expecting one of the following:
    because the FOR UPDATE; is invalid in your statement.
    Try this:
    //////////User A////////////////////////////////
    DECLARE
    v_salary squad.salary%TYPE := 300;
    v_pos squad.position%TYPE := 'Forward';
    v_n number;
    BEGIN
    UPDATE squad
    SET salary = salary + v_salary
    WHERE sname = 'Henry';
    select 1 into v_n from squad
    WHERE sname = 'Fabregas'
    for update;
    UPDATE squad
    SET position = v_pos
    WHERE sname = 'Fabregas';
    COMMIT;
    END;
    //////////////////////User B/////////////
    DECLARE
    v_salary squad.salary%TYPE := 200;
    v_pos squad.position%TYPE := 'Forward';
    v_n number;
    BEGIN
    UPDATE squad
    SET position = v_pos
    WHERE sname = 'Fabregas';
    select 1 into v_n from squad
    WHERE sname = 'Henry'
    for update;
    UPDATE squad
    SET salary = salary + v_salary
    WHERE sname = 'Henry';
    COMMIT;
    END;
    To syncronize the blocks first in a SQLPlus call these two statements:
    select 1 from squad WHERE sname = 'Fabregas' for update;
    select 1 from squad WHERE sname = 'Henry' for update;
    After this start the user A code in another SQLPlus, and start the user B code. After this call rollback or commit in the first sqlplus.
    Ott Karesz
    http://www.trendo-kft.hu

  • Select for update that doesn't return any rows

    Are there any odd side-effects that may occur if a select for update that returns no results is never committed? I wouldn't think there are, but I'm not sure if there would be some kind of overhead or unforeseen consequences. This isn't a terribly important question, but it's come up in some coding I've done and I've not been able to find any documentation addressing it.

    A select for update only locks rows that meet the predicate specified in the where clause. So, if the query returns no rows, no rows are locked.
    session1> SELECT * FROM t;
            ID DESCR
             1 Un
             5 One
             2 THIS IS WA
    session1> SELECT * FROM t
      2  WHERE id = 11 FOR UPDATE;
    no rows selectedA second session can update rows in the table
    session2> UPDATE t
      2  SET descr = 'One'
      3  WHERE id = 1;
    1 row updated.John
    Edited by: John Spencer on Jan 7, 2009 1:36 PM
    I just realized that, although you can do updates on the table after the select fo update that returns no rows, you cannot do DDL operations liike a truncate. Unless the session that does the select for update either ends the transaction (i.e. commit or rollback) or ends the session DDL operations will fail.

  • How to SELECT FOR UPDATE with CMP (Oracle)

    The most common database (Oracle) by default uses a scheme that does not fit into any of those isolation levels. A SELECT statement selects data at the start of the transactions, whereas a SELECT ... FOR UPDATE does something quite different. It is essential to do SELECT FOR UPDATEs before updating the row as SELECT does no lock. It's a hack that works well in practice.
    1. Which isolation level is this?
    2. More fundamentally, how an earth is it possible to use this scheme with CMP?! You would have to distinguish load() from loadForUpdate()! Is CMP inconsistent with Oracle?
    This is a pretty big whole in the CMP spec!

    No. thats no goes well.
    Transaction serializable in Oracle uses a optimistic
    concurrency system. And for update is a
    pessimistic concurrency.
    With optimistic: the system is faster but it can fail
    With pessimistic: if doesnt fail (usually;)
    You can solve the proble with many differents systems:
    1. Edit the .xml descriptor files ans change the sql sentences.
    And my prefer one.
    2. Make a new jdbc driver that inherits from the original
    oracledriver.
    The new driver give u in "getConnection()" a new connection class that inherits from the original connection.
    The executestatement and preparestatement adds the
    string "for update" if the stattement was starting by select.
    Configure your container to use the new driver.

  • Select for update returns no rows even though there is no locking thread

    I'm using Ibatis library over oracle sql for my query. The select for update statement returns no rows. This happens intermittently. When this was happening last time, I executed the select statement on sqldeveloper (but without the 'for update') and got rows. This situation is not easily reproducible so I've not yet been able to ascertain whether rows are returned on sqldeveloper with the 'for update' clause. But I know for sure that there was no other thread locking the rows. How could this be happening?

    The select for update statement returns no rowsWhy do you think that a select for update will always return rows?
    the for update clause if there not to garantee the presence of rows but to lock the row when it is present
    sql> select * from t;
             A          B C
             1          1 step1
             2          2 step2
             3          3 step3Then session 1 issues the following select
    SELECT     *
          FROM t
         WHERE a = 1
    FOR UPDATE NOWAIT;If session 2 issues the same select before session 1 commits or rolls back
    SELECT     *
          FROM t
         WHERE a = 1
    FOR UPDATE NOWAIT;It will get the following error
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specifiedBut if session 2 issue such a kind of select
    sql> SELECT     *
      2        FROM t
      3       WHERE a = 99
      4  FOR UPDATE NOWAIT;
    no rows selectedYou see then that a select for update can return no rows
    Best Regards
    Mohamed Houri

  • Problem with "SELECT...FOR UPDATE OF..." and "POST command" combination

    Problem with "SELECT...FOR UPDATE OF..." and "POST command" combination
    Problem in committing transactions in Multiple Forms (Oracle Forms) with POST built-in command:
    Consider that the following statements are written in WHEN-WINDOW-CLOSED trigger of a called form.
    Statements in called form (Form name: FORM_CHILD):
    go_block('display_block') ;
    do_key('execute_query') ;
    -- Data from table_b will be populated in this block, based on the value of COLUMN_1 obtained
    -- from TABLE_A.
    -- Example: If the value of COLUMN_1 is 10, then all the matching records from TABLE_B, which
    -- are inserted with value 10 in TABLE_B.COLUMN_1 will be fetched and shown here.
    if user_choice = 'YES' then
    commit ;
    else
    rollback ;
    end if ;
    Statements in calling forms:
    There are two calling forms having following statements and it is going to call the above said called form.
    CALLING FORM 1
    Statements in KEY-COMMIT trigger:
    post;
    call_form(form_child, no_activate) ;
    Statements in ON-INSERT trigger:
    select column_1
    from table_a
    for update of column_1
    where column_2 = 'X' ;
    update table_a
    set column_1 = column_1 + 1
    where column_2 = 'X' ;
    insert into table_b ...;
    insert into table_b ...; Statements in KEY-COMMIT trigger:
    post;
    call_form(form_child, no_activate) ;
    CALLING FORM 2:
    Statements in ON-INSERT trigger:
    select column_1
    from table_a
    for update of column_1
    where column_2 = 'X' ;
    update table_a
    set column_1 = column_1 + 1
    where column_2 = 'X' ;
    insert into table_b ...;
    insert into table_b ...;
    insert into table_b ...;
    Our understanding:
    Assume that both the forms are running from two different machines/instances, issuing commit at the same time. In this case, forms will start executing the statements written in ON-INSERT trigger, the moment POST command is executed. Though the commit is issued at the same time, according to oracle, only one of the request will be taken for processing first. Assume that calling form 1 is getting processed first.
    So, it fetches the value available in COLUMN_1 of TABLE_A and locks the row from further select, update, etc. as SELECT...FOR UPDATE command is used (note that NOWAIT is not given, hence the lock will be released only when COMMIT or ROLLBACK happens) and proceed executing further INSERT statements. Because of the lock provided by the SELECT...FOR UPDATE command, the statements in calling form 2 will wait for the resource.
    After executing the INSERT statements, the FORM_CHILD is called. The rows inserted in to TABLE_A will be queried and shown. The database changes will be committed when user closes the window (as COMMIT is issued in its WHEN-WINDOW-CLOSED trigger). Then the SELECT...FOR UPDATE lock will be released and calling form 2's statements will be executed.
    Actual happenings or Mis-behavior:
    Calling form 2 starts executing INSERT statements instead of waiting for SELECT...FOR UPDATE lock. Also, the value selected from TABLE_A.COLUMN_1 is same in both the calling forms, which is wrong.
    The rows inserted into TABLE_B are having similar COLUMN_1 values in calling form 2 and they are fetched and shown in the called form FORM_CHILD.
    Note that in calling form 2 also POST only is issued, but the changes posted there are accessible in calling form 1 also, which is wrong.
    Kindly suggest us as to how to fix above problem. It will be much use, if you can send us the information regarding the behavior of Oracle Forms POST built-in also.
    Our mail ID: [email protected]
    Thanks a lot in advance.

    You have several problems:
    1. On-Insert will ONLY run if you have created a new record in a base-table block. If you haven't done that, then the POST command will not cause it to run.
    2. Select for update without a "no wait" will lock records for the first form, but when the second form tries this, it will hit the ORA-00054 exception, and will NOT wait. The only way you could make it wait is to issue an UPDATE sql command, which is not such a good way to go.
    All POST does is issues SQL insert or update commands for any changes the user has made to records in a form's base-table blocks, without following with a Commit command.
    Also understand that Commit is the same as Commit_Form, and Rollback is the same as Clear_Form. You should read up on these in the Forms help topics.

  • Suddenly I can not select anything within the top inch or so of any web page. The scroll bar arrow doesn't work at the top. I don't know what to do. I tried updating my browser but the problem still exists.

    Everything worked fine on Tues. I shut down my system and then on Wed. morning, the problem appeared. Anything within the top inch or so of a webpage is unavailable to select. It is like there is an inch of the page that is dead. It is that way on every website that I visit with Firefox. It does not happen if I use internet explorer, which I do not like and do not want to have to go back to using. Please help!!! My sister in law has the same problem with firefox.

    Hi,
    Please [https://support.mozilla.org/en-US/questions/911441 see this.] You may also want to check if this happens in [https://support.mozilla.com/en-US/kb/Safe%20Mode Safe Mode.]

Maybe you are looking for