When I come across someone specifying "first" or "next" or "last" in a discussion of RDBMS rows, I must remind you that there is no logical sequence to any data stored in an RDBMS (DB2 or other).
So, with that knowledge, you must have an ORDER BY in your CURSOR. Only an ORDER BY (or something else to force a sort) will put rows into some guaranteed sequence.
And since an ORDER BY happens just before the data is returned to your application the only way to "skip" rows returned by the cursor is to FETCH 5 times without processing them.
This raises a question in my mind... why would you want to do this?
I have to believe that if you define your selection criteria better, you could develop a query that would return ONLY the rows you want. That is the proper method.
Last Wiki Answer Submitted: July 27, 2009 8:23 pm by Meandyou5,205 pts.