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
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend