About this task
To process the cursor that is associated with a SELECT
statement, first open the cursor, then fetch rows by specifying the
USING DESCRIPTOR clause of the FETCH statement. For example, a C application
can have following lines:
EXEC SQL OPEN pcurs
EMB_SQL_CHECK( "OPEN" ) ;
EXEC SQL FETCH pcurs USING DESCRIPTOR :*sqldaPointer
EMB_SQL_CHECK( "FETCH" ) ;
For a successful
FETCH, you could write the application to obtain the data from the
SQLDA and display the column headings. For example:
display_col_titles( sqldaPointer ) ;
After
the data is displayed, you should close the cursor and release any
dynamically allocated memory. For example:
EXEC SQL CLOSE pcurs ;
EMB_SQL_CHECK( "CLOSE CURSOR" ) ;