5. Working with Embedded SQL : Data Manipulation with Cursors : Readonly Cursors
 
Share this page                  
Readonly Cursors
Readonly cursors specify that the data does not intend to be updated. The FOR READONLY clause can be specified even if the cursor was declared FOR UPDATE; if this is done, updates on the data cannot be performed.
To improve performance, the DBMS Server pre-fetches (buffers) rows for readonly cursors. Use the SET_SQL(prefetchrows) statement to disable prefetching or to specify the number of rows to prefetch. To determine the number of rows that is prefetched for a particular readonly cursor, open the cursor, issue the INQUIRE_SQL(prefetchrows) statement.
By default the DBMS Server calculates the number of rows it can prefetch, taking into consideration the size of the row being fetched and the dimensions of internal buffers. If, using SET_SQL(prefetchrows), a value larger than the maximum number of rows the DBMS Server can prefetch is specified, prefetchrows is reset to its calculated maximum.
Note:  Prefetchrows cannot be set for readonly cursors that return long varchar or long byte columns.