DB2 sql logic fetch multi rows using Cursor

The below sql with Row set postioning works to get for multi row fetching.

Exec sql
Declare cursor c1 with rowset positioning
for select a,b
from dsn8011.emp
where a > 1000
Fetch Rowset from c1
for 5 rows
into :host-var-arry;
End-sql

Here host-var-arry, can handle data of 5 rows.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.