Declaring cursors

Declare a cursor for each select statement that returns multiple rows of data. You must declare the cursor before using it, and you cannot declare it within a declare section.

The syntax for declaring a cursor is:

exec sql declare  cursor_name  [cursor sensitivity]
[cursor scrollability] cursor
     for  select_statement ;

where: