Variables

A variable in an SQL statement specifies a value that can be changed when the SQL statement is executed.

There are several types of variables used in SQL statements:

global variable
Start of changeGlobal variables are either built-in global variables or user-defined global variables. For more information about how to refer to global variables see Global variables.End of change
host variable
Host variables are defined by statements of a host language. For more information about how to refer to host variables see References to host variables.
transition variable
Transition variables are defined in a trigger and refer to either the old or new values of columns. For more information about how to refer to transition variables see CREATE TRIGGER.
SQL variable
SQL variables are defined by an SQL compound statement in an SQL function, SQL procedure, or trigger. For more information about SQL variables, see References to SQL parameters and SQL variables.
SQL parameter
SQL parameters are defined in an CREATE FUNCTION (SQL scalar), CREATE FUNCTION (SQL table), or CREATE PROCEDURE (SQL) statement. For more information about SQL parameters, see References to SQL parameters and SQL variables.
parameter marker
Variables cannot be referenced in dynamic SQL statements. Parameter markers are defined in an SQL descriptor and used instead. For more information about parameter markers, see Parameter Markers in PREPARE.