Re: plpgsql - fetching from returned cursors

Поиск
Список
Период
Сортировка
Искать

Re: plpgsql - fetching from returned cursors

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"k|p"  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

plpgsql - fetching from returned cursors

От:
"k|p" <m.e.meulemans@student.utwente.nl>
Дата:
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

FAQ