Includes syntax added for scrollable cursors.
EXEC SQL DECLARE <curs_name>
[ <cursor sensitivity> ]
[ <cursor scrollability> ] CURSOR
FOR <cursor specification>
<cursor sensitivity> : : =
SEMI_SENSITIVE
| INSENSITIVE
<cursor scrollability> : : =
SCROLL
| NO SCROLL
<cursor specification> : : =
<select statement> [ <updatability clause> ]
<updatability clause> : : =
FOR {READ ONLY | UPDATE [ OF <column name list> ]}
END-EXEC
cursor sensitivity
Specified as SEMI_SENSITIVE or INSENSITIVE:
If cursor sensitivity is specified as INSENSITIVE, SCROLL is not implied.
If cursor sensitivity is not specified as INSENSITIVE or SEMI_SENSITIVE, and SCROLL is also not specified in the declare cursor, the cursor is scrollable and read-only with the specified sensitivity.
If cursor sensitivity is not specified, the cursor is declared as non-sensitive, non-scrollable and read-only.
cursor scrollability
Specified as SCROLL or NO SCROLL:
If cursor scrollability is specified as SCROLL, the cursor is INSENSITIVE.
If cursor scrollability is not specified, the default is NO SCROLL, and the cursor is declared as non-scrollable and read-only.
A scrollable cursor does not use fetch loops but rather
single fetch calls. Only non-scrollable and forward-only cursors
use fetch loops.