Hi, all
Following is a simple function which returns type of setof:
[CODE=SQL]CREATE OR REPLACE FUNCTION tesp_report_que ry()
RETURNS SETOF rpt.tesp_report _query AS
$BODY$
DECLARE
rec record;
BEGIN
create temp table tmpt_1 on commit drop as
select * from test_item_info;
FOR rec IN
select * from tmpt_1 LOOP
RETURN NEXT rec;
END LOOP;
RETURN;
END;$BODY$
LANGUAGE 'plpgsql';[/CODE]
-------
It works fine except that it only works once in a connection session. To make it work again have to restart a new connection. Is there any way to fix it? Thank you very much!
Jack
Following is a simple function which returns type of setof:
[CODE=SQL]CREATE OR REPLACE FUNCTION tesp_report_que ry()
RETURNS SETOF rpt.tesp_report _query AS
$BODY$
DECLARE
rec record;
BEGIN
create temp table tmpt_1 on commit drop as
select * from test_item_info;
FOR rec IN
select * from tmpt_1 LOOP
RETURN NEXT rec;
END LOOP;
RETURN;
END;$BODY$
LANGUAGE 'plpgsql';[/CODE]
-------
It works fine except that it only works once in a connection session. To make it work again have to restart a new connection. Is there any way to fix it? Thank you very much!
Jack
Comment