Reputation: 4091
I am running a query and it is too large. How may I retrieve the results in sections? For example, 1 million rows at a time.
Thank you
Upvotes: 1
Views: 207
Reputation: 5094
Use CURSOR
DECLARE my_curosor CURSOR FOR
SELECT ....
FETCH FORWARD 5 FROM my_cursor;
FETCH FORWARD 5 FROM my_cursor;
...
CLOSE my_cursor;
Another simplistic approach is to use LIMIT
and OFFSET
clauses.
Upvotes: 1