ASA Programming Guide
Using SQL in Applications
Working with cursors
The simplest way of processing the result set of a query using a cursor is to loop through all the rows of the result set until there are no more rows.
To loop through the rows of a result set
Declare and open the cursor (embedded SQL), or execute a statement that returns a result set (ODBC, JDBC, Open Client) or AsaDataReader object (ADO.NET).
Continue to fetch the next row until you get a Row Not Found
error.
Close the cursor.
How step 2 of this operation is carried out depends on the interface you use. For example,
ODBC SQLFetch, SQLExtendedFetch, or SQLFetchScroll advances the cursor to the next row and returns the data.
For more information on using cursors in ODBC, see Working with result sets.
ADO.NET Use the AsaDataReader.NextResult method. See NextResult method.
Embedded SQL The FETCH statement carries out the same operation.
For more information on using cursors in embedded SQL, see Using cursors in embedded SQL.
JDBC The next method of the ResultSet object advances the cursor and returns the data.
For more information on using the ResultSet object in JDBC, see Queries using JDBC.
Open Client The ct_fetch function advances the cursor to the next row and returns the data.
For more information on using cursors in Open Client applications, see Using cursors.