DECLARE cursor-name CURSOR FOR statement-name
cursor-name: identifier, or host variable
statement-name: identifier, or host variable
To declare a cursor. Cursors are used to retrieve query results a record at a time.
DROP, FETCH, OPEN, PREPARE.
This command associates a cursor with a particular statement. The statement name must have been used in a previous PREPARE command. Once declared, a cursor can be opened and fetched.
All cursors are scrollable in both directions and will remain open across COMMIT and ROLLBACK commands.
This command is functionally similar to the Embedded SQL command DECLARE. See "DECLARE CURSOR statement".