我已经成功创建了返回游标集的函数,即:
CREATE OR REPLACE FUNCTION select_multiple(refcursor, refcursor)
RETURNS SETOF refcursor AS
$BODY$
BEGIN
OPEN $1 FOR SELECT testtemptable.myid FROM testtemptable; -- Open the first cursor
RETURN NEXT $1; -- Return the cursor to the caller
OPEN $2 FOR SELECT testtemptable.name FROM testtemptable; -- Open the second cursor
RETURN NEXT $2; -- Return the cursor to the caller
END;
$BODY$
LANGUAGE plpgsql VOLATILE
我调用该函数,我希望每个游标返回 5 行,这看起来正在发生。这就是我所说的:
BEGIN;
select select_multiple('a', 'b');
FETCH ALL IN "a";
FETCH ALL IN "b";
COMMIT;
但是,我的问题是,如何“可视化”数据以验证返回的内容?“数据输出”选项卡根本不显示,“消息”选项卡显示
Query result with 2 rows discarded.
Query result with 5 rows discarded.
Query result with 5 rows discarded.
Query returned successfully with no result in 11 ms.
我的结果在哪里被丢弃了,如何在“数据输出”选项卡中显示它们?PostgreSQL 版本 9.1