获取SQL异常ORA-08103:java中不再存在对象

时间:2015-02-26 07:34:02

标签: java stored-procedures jdbc sys-refcursor

以下是我的程序签名:

PROCEDURE sp_trx(i_arr_Sust  IN    T_TAB_SUST,
                            o_locator_map    OUT   SYS_REFCURSOR,
                            o_pkid_map   OUT   SYS_REFCURSOR,
                            o_error    OUT   VARCHAR2) 

以下是我在程序中的引用光标:

   OPEN o_locator_map FOR
    SELECT c_uuid,
          c_id,
          r_locator,
          TO_CHAR(cj_creation_date, g_dt_format) c_date,
          TO_CHAR(cj_last_modified_date, g_dt_format) cj_last_modified_date,
          version_number
    FROM tmp_locator_map;

以下是oracle中的数据类型:

c_uuid-->VARCHAR2(50 BYTE), c_id--> NUMBER, r_locator--> VARCHAR2(10 BYTE)

以下是我的Java流程:

String insertStoreProc = "{call PKG_LOADER.sp_trx(?,?,?,?)}";
CallableStatement callableStatement  = con.prepareCall(insertStoreProc);
            callableStatement.setObject(1, returninParam, 2003);
            callableStatement.registerOutParameter(2, OracleTypes.CURSOR);
            callableStatement.registerOutParameter(3, OracleTypes.CURSOR);
            callableStatement.registerOutParameter(4, java.sql.Types.VARCHAR);
            callableStatement.execute();
            Object obj_recordLoc = callableStatement.getObject(2);
            ResultSet rset =((OracleCallableStatement) callableStatement).getCursor(2);

            while (rset.next()){
                 String c_uuid = rset.getString(1);
                      }

现在问题是我在 rset.next()下面提到例外:

  

java.sql.SQLException:ORA-08103:对象不再存在

请建议。 提前致谢

1 个答案:

答案 0 :(得分:1)

next() API声明如下:

When a call to the next method returns false, the cursor is positioned after the last row. Any invocation of a ResultSet method which requires a current row will result in a SQLException being thrown. If the result set type is TYPE_FORWARD_ONLY, it is vendor specified whether their JDBC driver implementation will return false or throw an SQLException on a subsequent call to next.

因此,当光标到达ResultSet的末尾时,您可能会遇到此Excpetion