What is equivalent to Oracle REF CURSOR in Postgresql when using JDBC?

In Oracle, I can declare a reference cursor ...

TYPE t_spool IS REF CURSOR RETURN spool%ROWTYPE;

... and use it to pass the cursor as the return value ...

FUNCTION end_spool
    RETURN t_spool
    AS
    v_spool t_spool;
    BEGIN
        COMMIT;
        OPEN v_spool FOR
            SELECT
                *
            FROM
                spool
            WHERE
                key = g_spool_key
            ORDER BY
                seq;
        RETURN v_spool;
    END end_spool;

... and then capture it as a result using JDBC ...

private Connection conn;
private CallableStatement stmt;
private OracleResultSet rset;
[...clip...]
stmt = conn.prepareCall("{ ? = call " + call + "}");
stmt.registerOutParameter(1, OracleTypes.CURSOR);
stmt.execute();
rset = (OracleResultSet)stmt.getObject(1);

What is the equivalent in Postgresql?

0
source share
1 answer

Perhaps this will help: http://jdbc.postgresql.org/documentation/83/callproc.html#callproc-resultset-setof

I still have not ruined this: P

+3
source

All Articles