DECLARE STATEMENT is not an executable statement. It can only be embedded in an application language.
The C language example below first declares an SQL statement variable named mystatement. Next the contents of the host variable hostvar (typically the text of an SQL statement assembled in the host application) are placed into mystatement using the PREPARE command:
EXEC SQL DECLARE mystatement STATEMENT ; ... EXEC SQL PREPARE mystatement FROM :hostvar ; ...
Description
This nonexecutable statement is used in application programs to identify statement-name variables that can later be substituted for various kinds of SQL statements.