Explain the cursor types

Explain the cursor types.

DYNAMIC: It reflects changes happened on the table while scrolling through the row.
STATIC: It works on snapshot of record set and disconnects from the server. This kind doesn’t reflects changes happened on the table while scrolling through the row.
KEYSET: In this kind, new record is not reflected, but data modification can be seen

Explain different types of cursors.

Different types of cursors:
Implicit cursors: these cursors are invoked implicitly. User need not create, open, fetch or close the cursor.

Explicit cursors: these cursors are not invoked implicitly. User needs to create, open, fetch or close the cursor.

Static Cursor: Stores a complete copy of the result set. Used mostly where scrolling is required. Static cursors don’t support updates.

Forward – only cursors: This cursor supports updates but not scrolling. It supports only fetching serially. Rows are not retrieved from the database until they are fetched.

Forward – only cursors / Read only cursor: These are the fastest of the cursors and cannot be updated. They cannot be created on query that returns only read only columns.

Key set driven: It is a scrollable cursor that cannot be updated. These cursors are controlled by a set of physical identifiers called as key set. The keyset is built in a temporary table when the cursor is opened.
Define the cursor lock types
Three types of locks READ ONLY: This prevents any updates on the table........
Cursor optimization tips
Close cursor when it is not required. You shouldn’t forget to deallocate cursor after closing it........
Disadvantages/limitation of the cursor
Cursor requires a network roundtrip each time it fetches a record, thus consume network resources........
Post your comment