Subject Re: [Firebird-Java] CallableStatement returning a ResultSet!
Author Roman Rokytskyy
> CallableStatement cs = conn.prepareCall("EXECUTE PROCEDURE
> TEST_RS_RETURN()");
> ResultSet rsc = cs.executeQuery();
> while(rsc.next()){
> System.err.println(rsc.getString(1));
> }
>
> The procedure must return a result set containing 3 records. But the
> returning result set containts only one record. Can you please tell
> me if is something wrong with my code? or what is the reason the
> ResultSet object containts only one record.

If your procedure is selectable, you have to use SELECT * FROM procedure.
EXECUTE PROCEDURE will select only first row. That's Firebird specifics. You
cannot use selectable procedures with EXECUTE PROCEDURE statements.

In your case you should use:

PreparedStatement stmt = con.prepareStatement(
"SELECT * FROM TEST_RS_RETURN()");
ResultSet rs = stmt.executeQuery();

> CallableStatement cs = conn.prepareCall("?=EXECUTE PROCEDURE
> TEST_RS_RETURN()");

This is completely incorrect. Please either use Firebird syntax or escaped
syntax.

> cs.registerOutParameter(1, Types.OTHER);

JayBird does not know Types.OTHER.

Roman