Variables in dynamic SQL
In dynamic SQL statements, parameter markers are used instead of variables other than global variables. Global variables are the only type of variable that can be specified in a dynamic SQL statement.
A parameter marker is a question mark (?) that represents a position in a dynamic
SQL statement where the application will provide a value; that is, where a variable would be found
if the statement string were a static SQL statement. The following examples show a static SQL
statement that uses variables and a dynamic statement that uses parameter markers:
INSERT INTO DEPT VALUES (:HV_DEPTNO, :HV_DEPTNAME, :HV_MGRNO, :HV_ADMRDEPT)
INSERT INTO DEPT VALUES (?, ?, ?, ?)
For more information on parameter markers, see Parameter markers under the PREPARE statement.