SQL: Types of Cursors


Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis, instead of the typical SQL commands that operate on all the rows in the set at one time. Cursor is the only datatypa that can not be used in table creation.

Types of Cursors:

1.Static: Cursor can move to any record but the changes on the data cannot be seen.
2. Dynamic: Most resource extensive. Cursor can move anywhere and all the changes on the data can be viewed.
3. Forword-only: Cursor move one step forward cannot move backwords.
4. Keyset-driven: Only updated data can be viewed, deleted and inserted data cannot be viewed.
5. Base table: Base table cursors are the lowest level cursor available. Base table cursor can scroll forword or backword with minimal cost, and can be updated.