plpgsql cursors, fetching more than one row

Поиск
Список
Период
Сортировка
От Magnus Naeslund(t)
Тема plpgsql cursors, fetching more than one row
Дата
Msg-id 42B05996.6060300@fbab.net
обсуждение исходный текст
Список pgsql-general
I was thinking of using cursors as a paging mechanism for an application.
Let's say I need to fetch <pagenr> 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 <pagenr*pagesize> IN my_cursor;
FETCH <pagesize> 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
Дата:
Сообщение: Re: PostgreSQL Client Aplications ?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: enebling regular user to create new users ?