Types of cursor commands

Table 2-11 summarizes the types of cursor commands a client can issue:

Table 2-11: Summary of cursor commands

Type of command

What it does

Declare

Associates a cursor name with the body of the cursor.

Open

Executes the body of the cursor, generates a cursor result set.

Information

Reports the status of the cursor, or sets the cursor row fetch count.

Fetch

Fetches rows from the cursor result set.

Update or Delete

Updates or deletes the contents of the current cursor row.

Close

Makes the cursor result set unavailable. Reopening a cursor regenerates the cursor result set.

Deallocate

Renders the cursor nonexistent. A cursor that has been deallocated cannot be reopened.

A typical client application issues cursor commands in the order in which they are listed in Table 2-11, but the order can vary. For example, a client might fetch against a cursor, close the cursor, then reopen and fetch rows from it again.