DECLARE CURSOR
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Associates a cursor with a static query or a prepared dynamic query statement. The query or the prepared statement can have references to host variables.
Syntax
|
Parameters
- cursor_name
-
A name you assign to the cursor. The name must meet the requirements for an identifier.
-
query_expression
clause[ORDER BYclauseFOR UPDATE][] -
A complete query expression.
- prepared_statement_name
-
The name assigned to a prepared SQL statement in an earlier
PREPAREstatement.
Notes
- You
must declare a cursor before any
OPEN,FETCH, orCLOSEstatement. - The scope of the cursor declaration is the entire source file
in which it is declared. The operations on the cursor, such as
OPEN,CLOSE, andFETCHstatements, can occur only within the same compilation unit as the cursor declaration. - The use of a cursor allows the execution of the positioned forms
of the
UPDATEandDELETEstatements. - If the
DECLAREstatement corresponds to a static SQL statement with parameter references:- The
DECLAREstatement must be executed before each execution of anOPENstatement for the same cursor. - The
DECLAREstatement and theOPENstatement that follows must occur within the same transaction within the same task. - If the statement contains parameter references to automatic variables
or function arguments, the
DECLAREstatement and the followingOPENstatement for the same cursor must occur within the same C function.
- The
Example
|
|