4 DECLARE STATEMENT — declare SQL statement identifier
8 EXEC SQL [ AT connection_name ] DECLARE statement_name STATEMENT
12 DECLARE STATEMENT declares an SQL statement identifier. SQL statement
13 identifier can be associated with the connection. When the identifier
14 is used by dynamic SQL statements, the statements are executed using
15 the associated connection. The namespace of the declaration is the
16 precompile unit, and multiple declarations to the same SQL statement
17 identifier are not allowed. Note that if the precompiler runs in
18 Informix compatibility mode and some SQL statement is declared,
19 "database" can not be used as a cursor name.
24 A database connection name established by the CONNECT command.
26 AT clause can be omitted, but such statement has no meaning.
29 The name of an SQL statement identifier, either as an SQL
30 identifier or a host variable.
34 This association is valid only if the declaration is physically placed
35 on top of a dynamic statement.
39 EXEC SQL CONNECT TO postgres AS con1;
40 EXEC SQL AT con1 DECLARE sql_stmt STATEMENT;
41 EXEC SQL DECLARE cursor_name CURSOR FOR sql_stmt;
42 EXEC SQL PREPARE sql_stmt FROM :dyn_string;
43 EXEC SQL OPEN cursor_name;
44 EXEC SQL FETCH cursor_name INTO :column1;
45 EXEC SQL CLOSE cursor_name;
49 DECLARE STATEMENT is an extension of the SQL standard, but can be used
54 CONNECT, DECLARE, OPEN