在 Oracle 中,我可以声明一个引用游标...
TYPE t_spool IS REF CURSOR RETURN spool%ROWTYPE;
...并使用它来传递游标作为返回值...
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;
...然后使用 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);
Postgresql 中的等价物是什么?