ALLBASE/SQL Reference Manual (36216-90216)

428 Chapter11
SQL Statements E - R
FETCH
Fetch the selected data into the data buffer. Additional rows are fetched with each
execution of the FETCH statement until all rows have been fetched. See the
ALLBASE/SQL for more detailed examples.
FETCH Dynamic1Cursor USING DESCRIPTOR SQLDA
Close the cursor to free the active set.
CLOSE Dynamic1Cursor
4. Dynamic select cursor using host variables
Assume that host variable Dynam1 contains a SELECT statement. The statement stored
in :Dynam1 is dynamically preprocessed.
PREPARE Dynamic1 FROM :Dynam1
Define a cursor to be used to move through the query result row by row.
DECLARE Dynamic1Cursor CURSOR FOR Dynamic1
Open the cursor to define rows of the active set.
OPEN Dynamic1Cursor
Fetch the selected data into the specified host variables. With each execution of the
FETCH statement one additional row is fetched until all rows have been fetched.
FETCH Dynamic1Cursor USING :HostVariable1, :HostVariable2
Close the cursor to free the active set.
CLOSE Dynamic1Cursor
5. Refer to the ALLBASE/SQL Advanced Application Programming Guide for a
pseudocode example of procedure cursor usage.