The uni_csr_disp.c sample program demonstrates how to use a read-only cursor. It is a modification of the csr_disp.c sample program and requires the unipubs2 database. It:
Opens a cursor with a query.
Processes the results using the standard ct_results while loop.
Binds the column values to program variables.
Fetches and displays the rows in the standard ct_fetch while loop.
This is the query:
select au_fname, au_lname, postalcode from authors
For instructions on installing the unipubs2 database, see the README file in $SYBASE/$SYBASE_OCS/sample/ctlibrary.