简体   繁体   English

为什么resultset.next()返回null

[英]why is resultset.next() returning null

in the code below the method resultset.next() is returning false 在方法resultet.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();

Why is it so??? 为什么会这样??? if i call same stored procedure from my database it results in 2 rows of output(provding same input as in java code) 如果我从数据库中调用相同的存储过程,则会导致两行输出(提供与Java代码相同的输入)

Your title expresses your confusion. 您的头衔表达了您的困惑。 ResultSet.next() returns a boolean, not anything that can be null. ResultSet.next()返回一个布尔值,而不是任何可以为null的值。 You need to call it before getObject(), not afterwards. 您需要 getObject() 之前调用它,而不是在之后调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM