6. QUEL and EQUEL Statements : Declare Cursor Statement—Declare a Cursor : Considerations
 
Share this page                  
Considerations
The same cursor name cannot be declared twice in a single program.
The scope of a cursor is the source file. A cursor name declared in one source file cannot be referred to in another file.
The EQUEL preprocessor does not generate any code for the declare cursor statement. If your host language does not allow empty control blocks, (for example, empty if blocks), the declare cursor statement must not be the only statement in the block.
Result columns which have the same name as a host variable must be dereferenced with the number (#) sign.
The retrieve clause for the declare cursor statement must obey the rules for the retrieve statement, with an additional restriction. A cursor retrieve clause does not allow you to store the results of the query in host variables. The target list assignments, when used, are result column names, not receiving host variables.
A cursor cannot be declared for update if its retrieve statement refers to more than one table or to a view, or includes a unique or a sort by clause.
You can use a host variable to specify the where clause and succeeding clauses (such as sort by or update). You can use host variables to specify table or column names.