When executing a FETCH statement to retrieve multiple rows of data, you can specify the number of rows to be retrieved as a parameter and obtain them all at once. This reduces overhead compared to retrieving data one row at a time, and performance improvement can be expected. At this time, the cursor moves to the last row of the retrieved data, so if you want to retrieve data other than the last row, use other search conditions instead of the cursor position.
Example
Definition of cursor
EXEC SQL DECLARE CUR01 CURSOR FOR SELECT * FROM tbl01 END-EXEC.
In the case of one FETCH
Store a value in the variable (VAR01).
EXEC SQL FETCH CUR01 INTO :VAR01 END-EXEC.
In the case of multiple FETCH
Store values in the array (ARRAY01).
EXEC SQL FETCH 100 INTO :ARRAY01 END-EXEC.