The DECLARE CURSOR statement must be used to declare a cursor, specify a name for the cursor, and the query that defines the result set associated with the cursor. The name specified is referred to in subsequent OPEN, FETCH, and CLOSE statements. The query is any valid select statement.
The declaration of a cursor can take place anywhere within the embedded SQL application, however it must be used before any references to it in other SQL statements.
Language | Example Source Code |
---|---|
C and C++ |
|
COBOL |
|
FORTRAN |
|