开发者

Return both OUT parameters and a rowset

开发者 https://www.devze.com 2023-03-29 00:42 出处:网络
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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消