I would like to return both output parametrs and a rowset.
In DB2, I can accomplish this with the following, and opening a cursor before the stored procedure ended:
CREATE PROCEDURE rqstprtl开发者_如何学JAVA.getInfo (
IN id BIGINT,
OUT var1 CHAR(6),
OUT var2 BIGINT
)
DYNAMIC RESULT SETS 1
I'm unsure how to accomplish the same thing with PostgreSQL functions. My understanding is that functions have a return type of record
(or no return type) for functions that have output parameters, but I would also need a return type of setof record
to return the rowset.
You can use a refcursor instead, so one OUT parameter should be a refcursor type.
Pavel
精彩评论