Overview of Cursor Types
- A Select cursor is a cursor associated with a SELECT statement.
- A Function cursor is a cursor associated with an EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement.
- An Insert cursor is a cursor associated with an INSERT statement.
Besides associating a cursor directly with the text of an SQL statement, the FOR keyword of the DECLARE statement can be followed by the identifier of a prepared SQL statement, associating the cursor with the result set of an INSERT, SELECT, EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement that was prepared dynamically. This feature enables you to associate different SQL statements with the same cursor at different times. In this case, the type of cursor depends on the prepared SQL statement that the statement_id or statement_id variable specifies when the cursor is opened. (For more information, see Associating a Cursor with a Prepared Statement.)