2 Ответы Последний ответ: 19.07.2002 20:12, автор: 843797

    Please help Problem with setLong during SELECT

    843797
      Hi All:

      When I try to use the following code it fails during runtime. Long type is passed as Command Line Argument to the Java Client.

      Any help will be greatly appreciated.

      Thanks

      -------------------------------

      try // do query
      {

      String query = "SELECT * FROM Doc_Log WHERE EVENT_ID = ?";
      System.out.println("SELECT STATEMENT....:"+"\t"+query);

      long PUBLISH_ID = EVENT_ID;
      System.out.println("EVENT_ID to be used is:"+"\t"+PUBLISH_ID);

      pstmt1 = conn.prepareStatement(query);
      pstmt1.setLong(1,PUBLISH_ID);
      // pstmt1.setString(1,Long.toString(EVENT_ID));
      rs1 = pstmt1.executeQuery(query);
      System.out.println(rs1);


      RUNTIME ERROR.............................


      SELECT STATEMENT....: SELECT * FROM Doc_Log WHERE EVENT_ID = ?
      EVENT_ID to be used is: 4703996961324730781
      java.sql.SQLException: ORA-01008: not all variables bound

      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
      at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:1597)
      at oracle.jdbc.oci8.OCIDBAccess.parseExecuteDescribe(OCIDBAccess.java:79
      8)
      at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.jav
      a:1674)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
      nt.java:1870)
      at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:
      538)
      at Doc_Pub.FailedEventReader(Doc_Pub.java:334)
      at Doc_Pub.main(Doc_Pub.java:241)
      BinaryReader: Error coming out of MyReader!

      Exception in thread "main" java.lang.NullPointerException
      at Doc_Pub.FailedEventReader(Doc_Pub.java:461)
      at Doc_Pub.main(Doc_Pub.java:241)