Specifying the number of rows in a rowset

If you do not explicitly specify the number of rows in a rowset, DB2® implicitly determines the number of rows based on the last fetch request.

About this task

To explicitly set the size of a rowset, use the FOR n ROWS clause in the FETCH statement. If a FETCH statement specifies the ROWSET keyword, and not the FOR n ROWS clause, the size of the rowset is implicitly set to the size of the rowset that was most recently specified in a prior FETCH statement. If a prior FETCH statement did not specify the FOR n ROWS clause or the ROWSET keyword, the size of the current rowset is implicitly set to 1. For examples of rowset positioning, see Table 1.