Was this helpful?
DECLARE CURSOR--Declare a Cursor
Valid in: EQUEL
Declares a cursor.
This statement has the following format:
## declare cursor cursor_name 
##         for retrieve [unique] (target_list)
##         [where qual]
##         [sort by column[:sortorder] {, column[:sortorder]}]
##         [for [deferred | directupdate [of (column {, column})]]
The declare cursor statement associates a cursor name with a set of retrieval criteria. The declare cursor statement must occur before any other references to the cursor–declare cursor statements cannot be embedded in a host language variable declaration section.
If the cursor is used to update or delete rows, you must specify the for update clause and include all columns that are updated.
If the sort by clause is specified, the cursor retrieves rows sorted by result column, as specified. For each column on which you are sorting, you can specify the sortorder parameter as asc for ascending, or desc for descending.
The declare cursor statement does not retrieve any data (despite the presence of the retrieve clause). Data is retrieved into host variables when you open the cursor and issue a retrieve cursor statement.
Last modified date: 06/08/2023