plpgsql cursors, fetching more than one row

Поиск
Список
Период
Сортировка
Искать
От
Magnus Naeslund(t)
Тема
plpgsql cursors, fetching more than one row
Дата
Msg-id
42B05996.6060300@fbab.net
Список
I was thinking of using cursors as a paging mechanism for an application.
Let's say I need to fetch  from a table.
If I use these commands from the client it works:

BEGIN WORK;
DECLARE my_cursor CURSOR FOR
   SELECT * FROM test1 ORDER BY id ASC
  FOR READ ONLY;

MOVE  IN my_cursor;
FETCH  FROM my_cursor;

CLOSE my_cursor;
COMMIT WORK;

Nice and easy.

But how can I do this from within PLPGSQL?
I see no way of fetching more than one (and less than ALL) row and at 
the same time process them within the procedure itself.

Probably I'm missing something simple here...?

Regards,
Magnus
В списке pgsql-general по дате отправления
От: David Siebert
Дата:
От: Tom Lane
Дата:
FAQ