簡體   English   中英

為什么resultset.next()返回null

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

在方法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();

為什么會這樣??? 如果我從數據庫中調用相同的存儲過程,則會導致兩行輸出(提供與Java代碼相同的輸入)

您的頭銜表達了您的困惑。 ResultSet.next()返回一個布爾值,而不是任何可以為null的值。 您需要 getObject() 之前調用它,而不是在之后調用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM