1
獲取的數據我已經成功地創建了返回集合光標的功能,即:PostgreSQL的 - 顯示光標
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
你的腳本在psql中適合我。你有沒有專門針對pgAdmin3的問題? – 2013-03-20 09:30:04
是的,我認爲這是pgAdmin3特有的。我會嘗試在psql中運行我的腳本,如果必須的話,謝謝。 – Evgeny 2013-03-21 03:36:31