plpgsql - fetching from returned cursors
Is something like this possible?
Because the way I wrote it now, nothing is FOUND from the FETCH and the loop is
exited.
CREATE OR REPLACE FUNCTION test(integer) RETURNS integer AS '
DECLARE
my_cursor refcursor;
my_row row;
BEGIN
my_cursor = get_refcursor($1);
LOOP
FETCH my_cursor INTO my_row;
EXIT WHEN NOT FOUND;
RAISE DEBUG ''id: %'', my_row.id;
END LOOP;
END;
' LANGUAGE 'plpgsql';
Thanks,
kip
"k|p" <m.e.meulemans@student.utwente.nl> writes:
Is something like this possible?
Because the way I wrote it now, nothing is FOUND from the FETCH and the loop is
exited.
It works for me ... or at least it did after I changed "my_row" to type
RECORD, added a RETURN at the end, and made the RAISE be RAISE NOTICE
so I could actually see some output.
regards, tom lane