Scrollable Cursors
A scrollable cursor is commonly used in modern screen-based applications in which the user
scrolls back and forth through the data. However, applications should use scrollable
cursors only when forward-only cursors will not do the job, as scrollable
cursors are generally more expensive than forward-only cursors.
The ability to move backward raises a question not applicable to forward-only
cursors: Should a scrollable cursor detect changes made to rows previously
fetched? That is, should it detect updated, deleted, and newly inserted rows?
This question arises because the definition of a result set
The ability to detect changes is sometimes useful, sometimes not. For example,
an accounting application needs a cursor that ignores all changes; balancing
books is impossible if the cursor shows the latest changes. On the other hand,
an airline reservation system needs a cursor that shows the latest changes to
the data; without such a cursor, it must continually requery the database to show
the most up-to-date flight availability.
To cover the needs of different applications, ODBC defines four different
types of scrollable cursors. These cursors vary both in expense and in their
ability to detect changes to the result set. Note that if a scrollable cursor can
detect changes to rows, it can only detect them when it attempts to refetch those
rows; there is no way for the data source to notify the cursor of changes to
the currently fetched rows. Note also that visibility of changes is also
controlled by the transaction isolation level; for more information, see