ORA-17085 bug jdbc update on where statement

hi,
i'm going crazy. i have this bug since 2009 and i don't know how to do.
i'm sure it's a bug from jdbc oracle (because it's working with mysql)
i guess it's not possible to do update on a row where this row is in the where query.
1) Resultset with a where condition
2) resultset.next
3)resultset update (the where field)
4) resultset next
5) resultst previous
6) resultset update (the where field)
---> ORA-17085
let's do this table:
the table:
CREATE TABLE test (
c1 NUMBER(10,0) NOT NULL,
c2 VARCHAR2(5) NULL,
c3 NUMBER,
c4 VARCHAR(5)
ALTER TABLE test
ADD CONSTRAINT test_pk PRIMARY KEY (
c1
the code with the bug:
here's the code to do this bug
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class MyMain
Connection con;
ResultSet res;
Statement stat;
public MyMain()
System.out.println("Loading JDBC driver.");
String url = "jdbc:oracle:thin:DEMO/[email protected]:1521:ORCL";
String sPilote = "oracle.jdbc.driver.OracleDriver";
//String url = "jdbc:mysql://localhost/test?user=demo&password=demo";
//String sPilote = "com.mysql.jdbc.Driver";
try
Class.forName(sPilote);
con = DriverManager.getConnection(url);
stat = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
stat.execute("DELETE FROM test");
stat.execute("INSERT INTO test(C1,C2,C3,C4) values (1,'C1',11,'C41')");
stat.execute("INSERT INTO test(C1,C2,C3,C4) values (2,'C1',12,'C42')");
stat.execute("INSERT INTO test(C1,C2,C3,C4) values (3,'C3',13,'C43')");
stat.execute("INSERT INTO test(C1,C2,C3,C4) values (4,'C1',14,'C44')");
stat.execute("INSERT INTO test(C1,C2,C3,C4) values (5,'C5',15,'C45')");
stat.execute("INSERT INTO test(C1,C2,C3,C4) values (6,'C1',16,'C46')");
// con.commit();
// ERROR HERE
//res = stat.executeQuery("SELECT c1,c2,c3,c4 FROM test ORDER BY c1"); // WHERE c2='C1'
res = stat.executeQuery("SELECT c1,c2,c3,c4 FROM test WHERE c2='C1' ORDER BY c1");
while (res.next())
System.out.println("BEGIN: " + res.getInt("c1") + " " + res.getString("c2") + " " + res.getInt("c3") + " " + res.getString("c4"));
res.first();
res.next();
System.out.println("-> UPDATE c2=c5");
res.updateString(2, "C5");
res.updateRow();
// con.commit();
System.out.println(res.getInt("c1") + " " + res.getString("c2") + " " + res.getInt("c3") + " " + res.getString("c4"));
res.next();
// con.commit();
res.previous();
System.out.println("-> UPDATE c2=c10");
res.updateString(2, "C10");
res.updateRow();
System.out.println(res.getInt("c1") + " " + res.getString("c2") + " " + res.getInt("c3") + " " + res.getString("c4"));
res.beforeFirst();
while (res.next())
res.refreshRow();
System.out.println("END: " + res.getInt("c1") + " " + res.getString("c2") + " " + res.getInt("c3") + " " + res.getString("c4"));
System.out.println("Finish.");
catch (ClassNotFoundException e)
e.printStackTrace();
catch (SQLException e)
// TODO Auto-generated catch block
System.out.println( e.getErrorCode());
e.printStackTrace();
finally
if (con != null)
try
con.close();
catch (SQLException e)
// TODO Auto-generated catch block
e.printStackTrace();
public static void main(String argv[])
new MyMain();
output:
Loading JDBC driver.
BEGIN: 1 C1 11 C41
BEGIN: 2 C1 12 C42
BEGIN: 4 C1 14 C44
BEGIN: 6 C1 16 C46
-> UPDATE c2=c5
2 C1 12 C42
-> UPDATE c2=c10
17085
java.sql.SQLException:
so what to do to ask oracle to correct this bug ?
thanks and have a nice day

thanks for answer and sorry for not using code tag
i want to open support request but we don't have support for oracle :-(
well i try with all jdbc driver since 2009 and oracle 10g,10xe,11xe
java is 1.6 and 1.7
i really think it's about oracle jdbc because it's working with mysql.
if i do where 1=1 then it's working because the bug happen only if i update a field who is in the "where query"
let's see this code who has the same bug (more easy):
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Test2 {
     Connection con;
     ResultSet res;
     Statement stat;
     public Test2() {
          System.out.println("Loading JDBC driver.");
          String url = "jdbc:oracle:thin:demo/[email protected]:1521:XE";
          String sPilote = "oracle.jdbc.driver.OracleDriver";
          try {
               Class.forName(sPilote);
               con = DriverManager.getConnection(url);
               stat = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                         ResultSet.CONCUR_UPDATABLE);
               stat.execute("DELETE FROM test");
               stat.execute("INSERT INTO test(C1,C2,C3,C4) values (1,'C1',11,'C41')");
               stat.execute("INSERT INTO test(C1,C2,C3,C4) values (2,'C1',12,'C42')");
               stat.execute("INSERT INTO test(C1,C2,C3,C4) values (3,'C3',13,'C43')");
               stat.execute("INSERT INTO test(C1,C2,C3,C4) values (4,'C1',14,'C44')");
               stat.execute("INSERT INTO test(C1,C2,C3,C4) values (5,'C5',15,'C45')");
               stat.execute("INSERT INTO test(C1,C2,C3,C4) values (6,'C1',16,'C46')");
               res = stat
                         .executeQuery("SELECT c1,c2,c3,c4 FROM test WHERE c2='C1' ORDER BY c1");
               res.first();
               res.next();
               System.out.println("-> UPDATE c2=c5");
               res.updateString(2, "C5");
               res.updateRow();
               // con.commit();
               res.refreshRow(); // don't change something
               System.out.println(res.getInt("c1") + " " + res.getString("c2")
                         + " " + res.getInt("c3") + " " + res.getString("c4") +" should be: 2 C5 12 C42");
          } catch (ClassNotFoundException e) {
               e.printStackTrace();
          } catch (SQLException e) {
               System.out.println(e.getErrorCode());
               e.printStackTrace();
          } finally {
               if (con != null)
                    try {
                         con.close();
                    } catch (SQLException e) {
                         e.printStackTrace();
     public static void main(String argv[]) {
          new Test2();
}output:
Loading JDBC driver.
-> UPDATE c2=c5
2 C1 12 C42 should be: 2 C5 12 C42
thanks a lot for your help

Similar Messages

  • SAP XI JDBC update SQL statement

    Hi,
    I am new to JDBC to RFC configuration and is currently on a deadlock.
    We are running a real time JDBC update statement where records are created based on employee login. We have configured the sender adapter to retrieved 5 records for every 5 seconds using the SQL query below:
    select *  from dtable where  uploaded=false order by recordno asc limit 5;
    and update using:
    update dtable set uploaded=true where uploaded=false order by recordno asc limit 5;
    The problem is that when there are only 3 records retrieved in the selection, the update statement always update 5 records back. This makes records created in-between the select and update to be updated as well.
    Can anyone suggest the correct update statement? Can I use the record numbers retrieved from the first statement in the update?
    Thanks,
    Ryan

    Hi,
    >>>>Can anyone suggest the correct update statement?
    1. you have a few choices but one of them would be to use a stored procedure in the select statement (which would have both select and update statements)
    2.
    a) select *  from dtable where  uploaded=false order by recordno
    b) update dtable set uploaded=true where uploaded=false
    c) split them by 5 rows in the mapping (multimapping)
    Regards,
    Michal Krawczyk

  • ORA-17085

    Hi,
    The jdbc oracle has a bug.
    1) Resultset with a where condition
    2) resultset.next
    3)resultset update (the where field)
    4) resultset next
    5) resultst previous
    6) resultset update (the where field)
    ---> ORA-17085
    this is working with mysql. It's a JDBC Oracle bug.
    I'm using jdbc 10.2.0.2.0 with oracle 10.2
    here's the code to do this bug
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class MyMain
    Connection con;
    ResultSet res;
    Statement stat;
    public MyMain()
    System.out.println("Loading JDBC driver.");
    String url = "jdbc:oracle:thin:DEMO/[email protected]:1521:ORCL";
    String sPilote = "oracle.jdbc.driver.OracleDriver";
    //String url = "jdbc:mysql://localhost/test?user=demo&password=demo";
    //String sPilote = "com.mysql.jdbc.Driver";
    try
    Class.forName(sPilote);
    con = DriverManager.getConnection(url);
    stat = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    stat.execute("DELETE FROM test");
    stat.execute("INSERT INTO test(C1,C2,C3,C4) values (1,'C1',11,'C41')");
    stat.execute("INSERT INTO test(C1,C2,C3,C4) values (2,'C1',12,'C42')");
    stat.execute("INSERT INTO test(C1,C2,C3,C4) values (3,'C3',13,'C43')");
    stat.execute("INSERT INTO test(C1,C2,C3,C4) values (4,'C1',14,'C44')");
    stat.execute("INSERT INTO test(C1,C2,C3,C4) values (5,'C5',15,'C45')");
    stat.execute("INSERT INTO test(C1,C2,C3,C4) values (6,'C1',16,'C46')");
    // con.commit();
    // ERROR HERE
    //res = stat.executeQuery("SELECT c1,c2,c3,c4 FROM test ORDER BY c1"); // WHERE c2='C1'
    res = stat.executeQuery("SELECT c1,c2,c3,c4 FROM test WHERE c2='C1' ORDER BY c1");
    while (res.next())
    System.out.println("BEGIN: " + res.getInt("c1") + " " + res.getString("c2") + " " + res.getInt("c3") + " " + res.getString("c4"));
    res.first();
    res.next();
    System.out.println("-> UPDATE c2=c5");
    res.updateString(2, "C5");
    res.updateRow();
    // con.commit();
    System.out.println(res.getInt("c1") + " " + res.getString("c2") + " " + res.getInt("c3") + " " + res.getString("c4"));
    res.next();
    // con.commit();
    res.previous();
    System.out.println("-> UPDATE c2=c10");
    res.updateString(2, "C10");
    res.updateRow();
    System.out.println(res.getInt("c1") + " " + res.getString("c2") + " " + res.getInt("c3") + " " + res.getString("c4"));
    res.beforeFirst();
    while (res.next())
    res.refreshRow();
    System.out.println("END: " + res.getInt("c1") + " " + res.getString("c2") + " " + res.getInt("c3") + " " + res.getString("c4"));
    System.out.println("Finish.");
    catch (ClassNotFoundException e)
    e.printStackTrace();
    catch (SQLException e)
    // TODO Auto-generated catch block
    System.out.println( e.getErrorCode());
    e.printStackTrace();
    finally
    if (con != null)
    try
    con.close();
    catch (SQLException e)
    // TODO Auto-generated catch block
    e.printStackTrace();
    public static void main(String argv[])
    new MyMain();
    the table:
    CREATE TABLE test (
    c1 NUMBER(10,0) NOT NULL,
    c2 VARCHAR2(5) NULL,
    c3 NUMBER,
    c4 VARCHAR(5)
    ALTER TABLE test
    ADD CONSTRAINT test_pk PRIMARY KEY (
    c1
    )

    Just FYI. The problem isn't related to the ORDER BY because I am having the same problem in a simple one-table query that has no ORDER BY.
    Incidentally, the problem also isn't with the database per se because the same logical set of steps can be done using a cursor with an update where current of clause and no error occurs.
    This appears to be a problem with the way Oracle implements updatable result sets. I even tried explicitly setting the result set type to forward only thinking that maybe it didn't want you updating a scrollable result set. No luck.
    Incidentally, I have scoured the Oracle JDBC docs and although they list quite a few limitations on updatable resultsets, this isn't one of them. I tend to concur with the originator of this thread that this is a bug in the Oracle JDBC drivers.
    Has anyone else found a workaround for this problem?

  • Combine select and update into single statement,without bind-variable

    I have a problem, that I think is not possible to solve the way I want to, but I just wanted to check before leaving the idea...
    I am looking for a way to combine the select and the update statement into one single statement. This is what I wan't to achive: select some data, and update the data selected before returning them.
    On this site http://www.psoug.org/reference/update.html I see that the following are possible:
    var bnd1 NUMBER
    var bnd2 VARCHAR2(30)
    var bnd3 NUMBER
    UPDATE employees
    SET job_id ='SA_MAN', salary = salary + 1000,
    department_id = 140
    WHERE last_name = 'Jones'
    RETURNING salary*0.25, last_name, department_id
    INTO :bnd1, :bnd2, :bnd3;
    I need to have this as a single statement, and cannot use bind-variables. So I was hoping that something like this could be possible:
    UPDATE customer c
    SET c.HAS_CREDIT ='1'
    WHERE c.HAS_CREDIT = '0'
    RETURNING c.CUSTOMER_NO, c.FIRSTNAME, c.LASTNAME
    where c.HAS_CREDIT = '1'
    But this doesn't compile, complaining of missing into (ORA-00925: missing INTO keyword). And even though I would like this to be possible because this would solve my current problem, I think it would be very confusing. For instance; would the where clause of the returning part be operating after the update or before?
    Any comments or suggestions on how to get it work in a single statement, or should I just leave this path straight away?

    Hi,
    RETURNING only works with bind variables, see
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/returninginto_clause.htm#sthref3006
    The real problem is that the form of RETURNING clause with bind variables is only valid for single row update or insert statements.
    To update (or insert) multiple rows and return the data, you will need to use
    RETURNING BULK COLLECT INTO clause. See
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2236
    Cheers,
    Colin

  • [svn:cairngorm3:] 15301: - Fixing a bug in the case where a Message is dispatched without a ModuleId defined to a Module type which is not yet instantiated .

    Revision: 15301
    Revision: 15301
    Author:   [email protected]
    Date:     2010-04-09 03:30:11 -0700 (Fri, 09 Apr 2010)
    Log Message:
    - Fixing a bug in the case where a Message is dispatched without a ModuleId defined to a Module type which is not yet instantiated.
    - Updating the sample to show this use-case.
    Modified Paths:
        cairngorm3/trunk/libraries/Module/src/com/adobe/cairngorm/module/ModuleMessageDispatcher. as
        cairngorm3/trunk/libraries/ModuleTest/src/CairngormModuleLibSample.mxml

    Hello,
    The error
    2. How to get rid of "ORA-06512: at"FLOWS_030100.WWV_FLOW_RENDER_QUERY", line 636"?you can also find in the new features application. I wrote a post about that some days ago:
    Bug in New Features Application?
    Had some trouble to get the PDF print working, too. Printing works fine for standard reports, but for interactive report I am not able to get it working. Sometimes I am getting only blank pages (and no file) and sometimes I am getting PDF's which just contain an internal 500 error. Some details are in this thread: Print Interactive Reports does not work
    Maybe that's related to the error of kkkannan74.
    Regards, Tine.

  • Why my JDBC UPdate hangs up??

    Hi, Sir::
    I use following simple JDBC Update program to update my table TEST,
    See following code:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    // create table test(Test_ID number, Test_Val varchar(30));
    public class Update {
      public static void main(String args[]) {
        Connection con = null;
        if (args.length != 2) {
          System.out.println("Syntax: <java UpdateApp [number] [string]>");
          return;
        try {
          String driver = "oracle.jdbc.driver.OracleDriver";
          Class.forName(driver).newInstance();
          String url = "jdbc:oracle:thin:@localhost:1521:usa";
          con = DriverManager.getConnection(url, "scott", "tiger");
          Statement s = con.createStatement();
          String test_id = args[0];
          String test_val = args[1];
          int update_count = s.executeUpdate("INSERT INTO test (test_id, test_val) "
                  + "VALUES(" + test_id + ", '" + test_val + "')");
          s.executeUpdate("UPDATE test SET TEST_VAL= 'John Alan' WHERE TEST_ID=1");
          System.out.println(update_count + " rows inserted.");
          s.close();
        } catch (Exception e) {
          e.printStackTrace();
        } finally {
          if (con != null) {
            try {
              con.close();
            } catch (SQLException e) {
              e.printStackTrace();
               When I run with command:
    C:\temp\javaCode>java Update 2 MyTest
    It hangs here and did not process, If I remove the statement:
    s.executeUpdate("UPDATE test SET TEST_VAL= 'John Alan' WHERE TEST_ID=1");
    it works and insert 1 record into Test Table.
    What is wrong here??
    How to fix it??
    Thanks
    Sunny

    Did you try with another Statement? I would try closing the first statement and creating a new one.
          Class.forName(driver).newInstance();
          String url = "jdbc:oracle:thin:@localhost:1521:usa";
          con = DriverManager.getConnection(url, "scott", "tiger");
          Statement s = con.createStatement();
          String test_id = args[0];
          String test_val = args[1];
          int update_count = s.executeUpdate("INSERT INTO test (test_id, test_val) "
                  + "VALUES(" + test_id + ", '" + test_val + "')");
           // close it and create a new one
           s.close();
           s = con.createStatement();
          s.executeUpdate("UPDATE test SET TEST_VAL= 'John Alan' WHERE TEST_ID=1");
    Let me know if it works.

  • JDBC Sender - Wrong SELECT statement (Oracle driver)

    Hi,
    3 days ago I was having a problem with my JDBC Sender adapter [JDBC Sender adapter is reading but then there isn't the message in SXMB_MON; .
    Finally I discovered what's wrong but I can't understant why is not working. When I deleted the "WHERE" condition in my SELECT statement all worked OK (except that I need the WHERE statement...).
    Why that statement is not working in my JDBC Sender:
    SELECT * FROM MATERIALES WHERE LEIDO<>'X'
    and that statement works:
    SELECT * FROM MATERIALES
    The field "LEIDO" is my flag that I must set to X when I read with the UPDATE statement, so I need the where condition...

    Thanks Christopher but still not working
    I tried two new statements:
    1 - Escaping:    SELECT * FROM MATERIALES WHERE LEIDO <> 'X'
    2 - Changing the operator symbol: SELECT * FROM MATERIALES WHERE LEIDO != 'X'
    The nº1 gives me an error of invalid character
    The nº2 has the same effect than the other symbol, the adapter reads from the DB but no XML message is generated and no payload to check what's happening... just a message ID without information and without a message generated in SXMB_MONI

  • HELP - Where statement to look for Sting

    I want to update the where clasue to include multiple metadata types. We have action-acct and fail-acct
    select a.account_number b.metadata
    from accounts a, data b
    WHERE 'disable-acct'= B.metadata(+)
    is this correct?
    select a.account_number b.metadata
    from accounts a, data b
    WHERE 'disable-acct'= B.metadata(+) or
    'action-acct' = B.metadata(+)

    user607303 wrote:
    that does not return any values. I think that statement is looking for the presence of both Police and Dune. It should be something closer to either Police or Dune. Ah, an OP with a sense of humour, that's good. :)
    My query had the or clause but it generates an error for outerjoins.It will...
    SQL> ed
    Wrote file afiedt.buf
      1  with accounts as (select 1 as account_number from dual union all
      2                    select 2 as account_number from dual)
      3      ,data as (select 'disable-acct' as metadata from dual)
      4  select a.account_number, b.metadata
      5  from accounts a, data b
      6  where 'disable-acct' = b.metadata(+)
      7* or 'action-acct' = b.metadata(+)
    SQL> /
    or 'action-acct' = b.metadata(+)
    ERROR at line 7:
    ORA-01719: outer join operator (+) not allowed in operand of OR or IN
    SQL>But if you use ANSI syntax...
    SQL> ed
    Wrote file afiedt.buf
      1  with accounts as (select 1 as account_number from dual union all
      2                    select 2 as account_number from dual)
      3      ,data as (select 'disable-acct' as metadata from dual)
      4  select a.account_number, b.metadata
      5* from accounts a left outer join data b on (b.metadata in ('disable-acct','action-acct'))
    SQL> /
    ACCOUNT_NUMBER METADATA
                 1 disable-acct
                 2 disable-acctor
    SQL> ed
    Wrote file afiedt.buf
      1  with accounts as (select 1 as account_number from dual union all
      2                    select 2 as account_number from dual)
      3      ,data as (select 'disable-acct' as metadata from dual)
      4  select a.account_number, b.metadata
      5* from accounts a left outer join data b on (b.metadata = 'disable-acct' or b.metadata = 'action-acct')
    SQL> /
    ACCOUNT_NUMBER METADATA
                 1 disable-acct
                 2 disable-acctAlthough I'm not sure what your query is trying to achieve from what little you posted.

  • Avoid JDBC sender error: Execute statement did not return a result set

    Hi!
    My JDBC sender adapter towards MS SQL server works fine, with an Execute statement calling a stored procedure that returns the source data needed. The stored procedure itself updates the status of database table records, so that only the unread records are returned each time the stored procedure is called.
    However, the communication channel monitoring sets a red flag for the JDBC sender adapter, when there are no values to fetch from the database table (using the stored procedure). Message says: "Database-level error reported by JDBC driver while executing statement 'EXECUTE FetchMessage 1, 9000'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor."
    This is not an error situation, as I do not expect there to be any values to fetch from the database at all times.
    I do not see how to change the stored procedure to avoid this error.
    Is there a parameter to be set on the JDBC adapter that I can use, so the red flag is avoided?
    Thanks for any input!
    Regards,
    Oeystein Emhjellen

    Hi Oeystein Emhjellen.
    The problem is Store Procedure that has to generate always a ResultSet (or cursor). If it doesn't have a output, you have to generate an Empty ResultSet.
    Like a SELECT Statement:
    If there are data, SELECT get an output result but if it get nothing the SELECT Statement get a empty ResultSet.
    Ask to your database team.
    I hope it helps you.
    Bruno.

  • Using alias in where statement

    simple sql:
    SELECT EMPLOYEE_ID,
    FIRST_NAME,
    LAST_NAME,
    EMAIL,
    PHONE_NUMBER,
    HIRE_DATE,
    JOB_ID,
    SALARY,
    COMMISSION_PCT,
    MANAGER_ID,
    DEPARTMENT_ID
    FROM EMPLOYEES
    WHERE EMPLOYEE_ID > 1000;
    is it somehow possible to use alias in where statement like
    SELECT EMPLOYEE_ID "ID",
    FIRST_NAME,
    LAST_NAME,
    EMAIL,
    PHONE_NUMBER,
    HIRE_DATE,
    JOB_ID,
    SALARY,
    COMMISSION_PCT,
    MANAGER_ID,
    DEPARTMENT_ID
    FROM EMPLOYEES
    WHERE "ID" > 1000;

    Hi,
    is it somehow possible to use alias in where statement likeWhy do you need it?
    To answer your question "Not directly"
    SQL> select empno eno, sal
      2  from emp
      3  where eno = 7900;
    where eno = 7900
    ERROR at line 3:
    ORA-00904: "ENO": invalid identifierColumn Alias are names given to give meaningful names to columns or the arithmetic operations' column.
    Twinkle

  • Use of the "updlock" hint with update and insert statements

    I have inherited some stored procedures and am trying to figure out why the developers decided to use the "updlock" hint on many of the update and insert statements. I have looked around everywhere and have found only one explanation of why "update...with
    (updlock)" can be useful, namely when a table has no clustered index:
    http://www.sqlnotes.info/2012/10/10/update-with-updlock/ I have found nothing yet that mentions why "insert into...with (updlock)" might be used. I understand why the hint
    might be useful on select statements in some cases, but if all of the tables have clustered indexes, is there any good reason to use it on update and insert statements?
    Thanks,
    Ron
    Ron Rice

    This form of deadlock error can occur on a table which has a clustered index.
    If you are doing updates on a table which has a clustered index and that table also has a nonclustered index and the nonclustered index is used to find the row to update you can see this type of deadlock.  For example create a table with a clustered
    primary key index and a nonclustered index by running
    Create Table Foo(PK int primary key identity, OtherKey varchar(10), OtherData int);
    go
    Insert Foo Default Values;
    go 10000
    Update Foo Set OtherKey = 'C' + Cast(PK As varchar(10))
    Create Unique Index FooIdx On Foo(OtherKey);
    That creates a table with 10000 rows, a clustered index and a nonclustered index.  Then run
    Begin Transaction
    Update Foo Set OtherData = 1 Where OtherKey = 'C5'
    That will use the FooIdx index to find the row that needs to be updated.  It will get a U lock on the index row in the FooIdx index, then an X lock on the row in the clustered index, update that row, then free the U lock on FooIdx, but keep the X lock
    on the row in the clustered index.  (There is other locking going on, but to simplify things, I'm only showing the locks that lead to the deadlock).
    Then in another window, run
    Begin Transaction
    Update Foo Set OtherData = 2 Where OtherKey = 'C5'
    This will get a U lock on the index row in the FooIdx index, then try to get an X lock on the row in the clustered index.  But that row is already exclusively locked, so this second window will wait holding a U lock on FooIdx row and is waiting for
    an X lock on the clustered index row.
    Now go back to the first window and run
    Update Foo Set OtherData = 3 Where OtherKey = 'C5'
    This will once again try to get the U lock on the FooIdx row, but it is blocked by the U lock the second window holds.  Of course the second window is blocked by the X lock on the clustered index row and you have a deadlock.
    All that said, I certainly do not routinely code my updates with UPDLOCK.  I try to design databases and write code so that deadlocks will be rare without holding excessive locks.  The more locks you hold and the longer you hold them, the more
    blocking you will get and the slower your system will run.  So I write code that if a deadlock exception occurs, it is properly handled.  Then if too many deadlocks occur, that is the time to go back to the code to see what changes are needed to
    decrease the number of deadlocks (one way to do that may be to get locks earlier and/or hold them longer. 
    But I wouldn't worry much about this form of deadlock.  It is, in my experience, vary rare.  I don't recall ever seeing it in a production environment.
    Tom

  • Apex 4.0 Image Buttons to update SQL Where clause of Report?

    I made a table called Letters with 1 column in it called Letter and the data in it is simply A,B,C, to H. I made an apex form around this table and then created two image buttons A and B that display above the reporting area b/c i want to be able to click on the A image button and have it update the Where clause for the Letters table to be "Where Letter = A" (so once you click the A button, only the A will appear), same for the B button. I have attached a link to an album of images to show what i'm trying to do to better explain it. I just can't figure out what or how to make it so that the image button can update the where clause. I should note that i am relatively new to Apex and i tried using a dynamic action to do it but can't get this to work.
    Link to images of what i have so far-> http://imgur.com/a/guxkd/oracle_apex_40_use_image_buttons
    Any suggestions?
    Edited by: Brobot on Feb 8, 2011 9:58 PM

    Since you are using some kind of button(with images or otherwise) , add some attributes to identify them together aswell as uniquely.
    For instance if you add a name and an a common classname to each button
    For example, in button attributes for A this could be
    name="A" class="where_clause_button"You can use these attributes to trigger a Dynamic action which can refresh the report.
    Since you want the report to be filtered based on the button(ie using the "name" attribute of the corresponding button) , you need to set that value in some hidden item, say P100_FILTER_LETTER. and add a where clase to your Report Region' SQL Query
    WHERE <column name> = :P100_FILTER_LETTERNow create a Dynamic Action as
    Event :Click
    Triggering Element : jQuery selector
    Selector : *.where_clause_button*
    <li>True action 1 : Execute Javascript code
    filter_item_name = 'P100_FILTER_LETTER'
    this_button_name = $(this.triggeringElement).attr('name');
    //Set session state of Hidden Item before refresh
    var ajaxRequest=new htmldb_Get(null,$v('pFlowId'),'null',$v('pFlowStepId'));
    ajaxRequest.add( filter_item_name ,this_button_name );
    var ajaxResult=ajaxRequest.get();<li> True Action 2: Refresh
    Affected Element: Region
    Name : Choose Report Region Name
    Hope it helps

  • ORA-1653: unable to extend table PERFSTAT.STATS

    Hi there,
    I know it's Friday and by the end of the week we normally are not that alert anymore.
    However now we have a very puzzling problem, one that leaves two DBA's very amazed.
    This morning our alert-log of a 9.2.0.8 database on AIX 5.3 showed:
    ORA-1653: unable to extend table PERFSTAT.STATS in tablespace TOOLSEasy, one would say. Extend the tablespace and you're done.
    However the tablespace is on autoextend, not even mentioned that it has 2.5Gb of free space.
    It is also "Locally Managed", with uniform extent size of 16Kb and manual "segment space management"
    The index of this table is in the same tablespace.
    The storage parameters are set to "unlimited" possibilities.
    A manual
    exec statspack.snapresults in the same error where as a
    create table statstest as select * from stats$sqltext ; works fine. The mentioned source table here is the one which seems unable to extend due to the "tablespace restrictions"
    Some storage parameters:
    CREATE TABLE "PERFSTAT"."STATS$SQLTEXT" (
    "HASH_VALUE" NUMBER NOT NULL ENABLE,
    "TEXT_SUBSET" VARCHAR2 (31) NOT NULL ENABLE,
    "PIECE" NUMBER NOT NULL ENABLE,
    "SQL_TEXT" VARCHAR2 (64),
    "ADDRESS" RAW (8),
    "COMMAND_TYPE" NUMBER,
    "LAST_SNAP_ID" NUMBER,
    CONSTRAINT "STATS$SQLTEXT_PK" PRIMARY KEY
    ("HASH_VALUE", "TEXT_SUBSET", "PIECE
    USING INDEX
    PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE
    INITIAL 1048576
    NEXT 1048576
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    ) TABLESPACE "TOOLS"
    ENABLE
    PCTFREE 5
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    NOCOMPRESS
    LOGGING
    STORAGE (INITIAL 5242880
    NEXT 5242880
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT)
    TABLESPACE "TOOLS"Can this be some kind of Data Dictionairy corruption ??

    virendra.k wrote:
    The next extent clause in creation script says that it is required to have at least 1G of contiguous memory. But the satement fails which means that a chunk of this size cannot be allocated. The situation may arise due to fragmentation of tablespace. See metalink doc id [1020182.6|https://metalink2.oracle.com/metalink/plsql/f?p=130:14:9000433346754441541::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,1020182.6,1,0,1,helvetica] if the largest free chunk >= 1G. Other wise increase the size of tablespace. It may help you.
    I don't understand the result of 1G you calculated.
    I only see: NEXT 1048576 of the primary key, which is 1M and NEXT 5242880 ( 5M) of the table itself.
    However it the Note lead me to the solution.
    The largest piece of contiguous free space in the tablespace is, according to this Note:
    TABLESPACE NAME CONTIGUOUS BYTES
    TOOLS                                 3,407,872 ==> 3Mb
    TOOLS 3,407,872
    TOOLS 3,407,872
    TOOLS 3,301,376
    TOOLS 3,194,880
    TOOLS 3,194,880
    TOOLS 3,194,880
    TOOLS 3,194,880
    TOOLS 3,088,384
    So I executed the following:
    SQL> alter table stats$sqltext storage (next 1m);And subsequently:
    SQL> exec statspack.snap;Which now succeeds !!
    Conclusion: Tablespace REORG needs to be planned.
    One more strange thing however:
    I altered the NEXT_EXTENT size back to 5M, and again the statspack.snap now works OK.
    It must be the either a background COALESCE that solved the problem, or the (maybe existing) corruption in the dictionary is now fixed/gone
    Thanks for the assistance

  • Jdbc - updating multiple tables

    Hello
    I am working on an old app using jdbc. There is a requirement to update several tables at once
    At the moment it is done roughly as follows
    //set autocommit to false
    PreparedStatement ps1 = connection.prepareStatement( sql_1 );
    //set parameters on ps1
    PreparedStatement ps2 = connection.prepareStatement( sql_2 );
    //set parameters on ps2
    ...and so on
    //execute updates on each statement
    connection.commit();
    However shouldnt this be done with batch processing? Are there any advantages/disadvantages to the above procedure?
    many thanks
    Stephen

    Batching should be faster. Let me guesstimate some numbers:
    A simple insert with not too many columns might take 5 ms. Do that ten times and it'll be 50 ms. A hundred inserts 500 ms.
    If you batch the inserts, one insert will still take 5 ms. Ten inserts might take 10 ms. A hundred inserts 50 ms.
    So you need to figure: how many inserts are you really doing and how often. If you are talking about saving half a second twice a day, stop messing with that already working and debugged code. Or do you insert 10,000 rows every minute all around the clock - at which point you may care significantly more.
    If you find that you might care, time your setup. Time the inserts you do now, then time it with batching. Different databases and drivers will greatly affect your mileage. There may be databases whose wire protocol does not even support batching.

  • [svn:fx-trunk] 9127: Fixes bug in Slider animation where we would set the actual value during the animation , ignoring any snapInterval setting.

    Revision: 9127
    Author:   [email protected]
    Date:     2009-08-05 17:25:39 -0700 (Wed, 05 Aug 2009)
    Log Message:
    Fixes bug in Slider animation where we would set the actual value during the animation, ignoring any snapInterval setting. The fix uses the pendingValue property to hold the animated value, which makes the slider look correct, but no actual value update is sent until the animation completes.
    QE notes: None
    Doc notes: None
    Bugs: SDK-21776
    Reviewer: Hans
    Tests run: checkintests, Mustella (gumbo/components/Slider)
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-21776
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Slider.as

    Revision: 9127
    Author:   [email protected]
    Date:     2009-08-05 17:25:39 -0700 (Wed, 05 Aug 2009)
    Log Message:
    Fixes bug in Slider animation where we would set the actual value during the animation, ignoring any snapInterval setting. The fix uses the pendingValue property to hold the animated value, which makes the slider look correct, but no actual value update is sent until the animation completes.
    QE notes: None
    Doc notes: None
    Bugs: SDK-21776
    Reviewer: Hans
    Tests run: checkintests, Mustella (gumbo/components/Slider)
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-21776
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Slider.as

Maybe you are looking for

  • Creation Logical System

    Hi All, I have Installed ECC6 in C: drive & BI7 in virtual machine in same PC and created RFC connections between these two servers (ECC6 & BI7) and checked RFC connections in BI7 as mentioned below - RSA1 ->Source System -> Right Click on T90CLNT090

  • Finder methods for CMP beans

    We do not implement finder method in Bean class for CMP. As such, where do we implement finder methods such as findInRange() method? How does the container implement my custom "find" methods. Thanks

  • LabVIEW crashes when calling a dll

    I am trying to call a dll through my LabVIEW program. The dll implements a routine to access an ftp server. When the server is found, everything works as expected. However, if there is a delay in finding the server, LabVIEW throws an error � �An exce

  • Lenovo T400 Complaint

    Hi, I waited forever to get Solid State Drivie option on T400, then ordered it and picked it up at the UPS office in Watertown MA amidst a heavy snow storm after 2 trips. I come home and try to boot it up and find that 128G SSD (worth over $700 on a

  • ME23N - Item Assembly Text value

    Dear Experts, In ME23N, when i click on the Item->Assembly text the values are populated in test system. But same is not populated in my production system. 1. From which table the Assembly Instruction text is been populated? 2. Is there any way to tr