user2291144
user2291144

Reputation: 65

why is resultset.next() returning null

in the code below the method resultset.next() is returning 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)

Upvotes: 0

Views: 987

Answers (1)

user207421
user207421

Reputation: 311052

Your title expresses your confusion. ResultSet.next() returns a boolean, not anything that can be null. You need to call it before getObject(), not afterwards.

Upvotes: 1

Related Questions