Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取SQL异常ORA-08103:对象在java中不再存在_Java_Stored Procedures_Jdbc_Sys Refcursor - Fatal编程技术网

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

获取SQL异常ORA-08103:对象在java中不再存在,java,stored-procedures,jdbc,sys-refcursor,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) 下面是我的re

以下是我的程序签名:

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) 
下面是我的ref游标内部过程:

   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;
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);
                      }
以下是oracle中的数据类型:

c_uuid-->VARCHAR2(50 BYTE), c_id--> NUMBER, r_locator--> VARCHAR2(10 BYTE)
下面是我的Java过程:

   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;
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:对象不再存在

请建议。 提前感谢API的
next()
API声明如下:

当对下一个方法的调用返回false时,光标位于最后一行之后。任何需要当前行的ResultSet方法调用都将导致抛出SQLException。如果结果集类型仅为“向前”类型,则供应商将指定其JDBC驱动程序实现是返回false还是在后续调用next时抛出SQLException。


因此,当光标到达结果集的末尾时,您可能会遇到这种情况

o_pkid_map
o_error
仅在过程参数中定义,但是这些参数没有在代码段和Java代码中使用,您正在尝试从procedure.And
callableStatement.getObject(2)中获取不返回任何记录的两个索引与
((OracleCallableStatement)callableStatement)的索引相同o_locator_map在过程中也被定义为o_locator_map OUT SYS_REFCURSOR,我知道Object obj_recordLoc=callableStatement.getObject(2);和((OracleCallableStatement)callableStatement.getCursor(2);是相同的,但我只是想检查更好的选项。是否有索引号不匹配?请参阅我的第二条注释。不,我正在获取o_locator_map,它是过程声明中的第二个索引。我使用ResultSet rset=((OracleCallableStatement)callableStatement.getCursor(2)获取它;