java为什么是resultset。next()返回null
在方法resultset下面的代码中。next()返回false
String sql = "{?= call fun_consolidate_retrieve_vector_receipt_payment_details(?,?,?,?,?,?)}";
callableStatement = con.prepareCall(sql);
callableStatement = con.prepareCall(" {? = call fun_retrieve_vector_receipt_payment_details(?,?,?,?,?,?)}");
callableStatement.registerOutParameter(1, Types.OTHER);
callableStatement.setString(2, "PAYMENT");
callableStatement.setInt(3, 47);
callableStatement.setString(4, "24-05-2013");
callableStatement.setString(5, "24-09-2013");
callableStatement.setString(6, "Y");
callableStatement.setObject(7, resultSet);
con.setAutoCommit(false);
callableStatement.execute();
resultSet = (ResultSet) callableStatement.getObject(1);
boolean next = resultSet.next();
为什么会这样???如果我从数据库中调用相同的存储过程,它将产生两行输出(提供与java代码中相同的输入)
# 1 楼答案
你的头衔表达了你的困惑。结果集。next()返回一个布尔值,而不是任何可以为null的值。您需要在getObject()之前调用它,而不是之后