Dynamic Cursors

   

Dynamic cursors detect all changes made to the rows in the result set, regardless of whether the changes occur from inside the cursor or by other users outside the cursor. All insert, update, and delete statements made by all users are visible through the cursor. The dynamic cursor can detect any changes made to the rows, order, and values in the result set after the cursor is opened. Updates made outside the cursor are not visible until they are committed (unless the cursor transaction isolation level is set to "uncommitted").

For example, suppose a dynamic cursor fetches two rows and another application then updates one of those rows and deletes the other. If the dynamic cursor then fetches those rows, it will not find the deleted row, but it will display the new values for the updated row.

Because dynamic cursors detect rows inserted into and deleted from the result set, absolute fetching (that is, fetching specific row numbers) is not very useful with dynamic cursors because row numbers change as rows are inserted and deleted.

There is a variation on dynamic cursors called dynamic standard cursors. In a dynamic standard cursor, committed changes that are made by other processes and uncommitted changes that are made by the cursor owner become visible the next time the user fetches data.

Considering the Dynamic Cursor

The dynamic cursor is a good choice if your application must detect all concurrent updates made by other users.