Dynamic PREPARE Statement
The dynamic PREPARE statement associates an arbitrary SQL identifier with a character variable and compiles the SQL statement to which the character variable refers. The preprocessor generates a call to
sqldynprep()
for this statement.Following is the syntax for the dynamic PREPARE statement:
statement-id
An SQL identifier (limited to 18 characters) that identifies the prepared statement to other dynamic ESQL statements. The scope of a statement identifier (used also in the DESCRIBE, DECLARE CURSOR, 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 prepared statement.
request-string
A C character string (request string) that contains the SQL statement you want to prepare. This statement can be a cursor specification, INSERT, UPDATE (positioned or searched), DELETE (positioned or searched), or DDL statement. See the "Specifying SQL Statements" section for more information and additional restrictions on the request-string.
NOTE: Although you can prepare DDL statements, there is no advantage over using immediate execution. These statements do not accept dynamic parameter markers and the same DDL statement is typically not executed more than once in a session.For an example of the dynamic ESQL PREPARE statement, see Step 2 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 |