The obvious answer is to use "order by" to put the rows satisfying your select in the desired sequence, and close your cursor after nnn fetches.
The last issue of DB2 magazine indicates that with version 7, you can put in a "fetch first 1 row" on a query if only one row is required. I'm not sure what "fetch first 5 row" might yield.
See article:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.