fetch and close

After a cursor opens, the result sets are returned to the application. Then, the data is fetched and loaded into the application program host variables. Optionally, you can update or delete the data. The fetch and close statements are the same as in static Embedded SQL.

The syntax for the fetch statement is:

exec sql [at connection_name] fetch cursor_nameinto
:host_variable [[indicator]:indicator_variable]
 [,:host_variable 
 [[indicator]:indicator_variable]...];

where:

The syntax for the close statement is:

exec sql [at connection_name] close cursor_name;

where cursor_name is the name assigned to the cursor in the declare statement.