All host variables used in SQL statements must be explicitly declared. A host variable used in an SQL statement must be declared prior to the first use of the host variable in an SQL statement, except when the -sqltwop precompiler option is used. In addition:
- All host variables within an SQL statement must be preceded by a colon (:).
- The names of host variables must be unique within a program, even if the host variables are in different blocks or procedures.
- An SQL statement that uses a host variable must be within the scope of the statement in which the variable is declared.
- A host variable cannot be declared as an array.