在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中的等效内容是什么?
答案 0 :(得分:3)
也许这会有所帮助:http://jdbc.postgresql.org/documentation/83/callproc.html#callproc-resultset-setof
我之前并没有真正搞砸过:P