Dynamic DECLARE CURSOR Statement

The dynamic DECLARE CURSOR statement associates a cursor with a cursor specification that you previously prepared using a PREPARE statement. The preprocessor generates a call to sqldynsetn() for this statement. Multiple cursors are supported for both static and dynamic ESQL.

Following is the syntax for the dynamic DECLARE CURSOR statement:

SYNTAX
EXEC SQL DECLARE cursor-name CURSOR FOR statement-id ; 

cursor-name

An SQL identifier (limited to 18 characters) that specifies the name of a cursor.

statement-id

A statement identifier associated with a cursor specification in a previous PREPARE statement. The scope of a statement identifier (used also in the DESCRIBE and EXECUTE statements) extends to the entire ESQL source file. This means that any reference to this statement identifier in any function within the file refers to the same cursor specification.

NOTE: Unlike the static DECLARE CURSOR statement, which includes the complete text of the cursor specification, you do not include lock criteria in a dynamic ESQL DECLARE CURSOR statement. For dynamic ESQL, you specify lock criteria in the SQL request string following the cursor specification.

For an example of the dynamic ESQL DECLARE CURSOR statement, see Step 7 in the "Executing Dynamic Cursor Specifications" section in this chapter.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095