我正在使用ojdbc14,版本:10.2.0.4.0,但是在Java中使用JDBC提取过程时无法获取OracleTypes.CURSOR。
try {
CallableStatement callBackStmt = null;
CIDBConnector dao = new CIDBConnector();
connection = dao.getConnection();
callBackStmt = connection.prepareCall(query);
callBackStmt.registerOutParameter(1, OracleTypes.CURSOR);
callBackStmt.registerOutParameter(2, OracleTypes.CURSOR);
boolean hasMoreResultList = callBackStmt.execute();
if(hasMoreResultList){
ResultSet resultSet = null;
System.out.print("fetching result from procedure");
resultSet = (java.sql.ResultSet)callBackStmt.getObject(1);
while(resultSet.next()){
//setting the resultModel
ResultModel resultModel = new ResultModel();
resultModel.setLOR_NO(resultSet.getString(1));
resultModel.setORDER_NO(resultSet.getString(2));
resultModel.setINSERT_TIMESTAMP(resultSet.getTimestamp(3));
resultModel.setORDER_XML_TIMESTAMP(resultSet.getTimestamp(4));
resultModel.setMTAS_XML_TIMESTAMP(resultSet.getTimestamp(5));
resultModel.setCALLBACK_TIMESTAMP(resultSet.getTimestamp(6));
resultModel.setAAA_REQUIRED(resultSet.getString(7));
//adding to the list
modelList.add(resultModel);
}
resultSet = (java.sql.ResultSet)callBackStmt.getObject(2);