cursors in plpgsql

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема cursors in plpgsql
Дата
Msg-id 3F68C810.6020401@klaster.net
обсуждение исходный текст
Ответы Re: cursors in plpgsql
Список pgsql-sql
Hi
I wanted to use some select result several times in pl/pgsql function.

DECLARE  test    refcursor;  x    record;
BEGIN open test for select... fetch test into x;
while found loop  ...work...  fetch test into x;
end loop;

...rewind cursor using move... fetch test...

Neither move backward 10000 in test;
nor
execute ''move backward 10000 in test'';
doesn't work.

In first case I get:
ERROR:  parser: parse error at or near "$1"...
In secod:
ERROR:  unexpected error -5 in EXECUTE of query...
I tried also with "perform" - I got no error, but also no valid result.

What should I do with it?
Or maybe is it possible somehow to use cursor in FOR..IN loop?

Regards,
Tomasz Myrta



В списке pgsql-sql по дате отправления:

Предыдущее
От: Tomasz Myrta
Дата:
Сообщение: Re: how to get decimal to date form
Следующее
От: Tom Lane
Дата:
Сообщение: Re: cursors in plpgsql