SET Host Variable is an executable statement that can only be embedded in a host program. The statement cannot be dynamically prepared.
The privileges that are held by the current authorization ID must include those required to execute any of the expressions.
SET host-variable = { {CURRENT SERVER | CURRENT PACKAGESET} | host-variable = {expression | NULL} | (host-variable[,...]) = ({expression | NULL} [,...] | VALUES {{expression | NULL} | ({expression | NULL}[,...])}})}
If the SET Assignment statement is used in the triggered action of a CREATE TRIGGER statement, each host-variable must identify a transition variable. If the statement is used in any other context, each host-variable must identify a host variable.
The value to be assigned to each host-variable can be specified immediately following the item reference, for example, host-variable = expression, host-variable=expression. Or, sets of parentheses can be used to specify all the host-variables and then all the values, for example, (host-variable, host-variable) = (expression, expression).
Each host variable must be defined in the program as described under the rules for declaring host variables. A parameter marker must not be specified in place of host-variable.
When the host-variables are enclosed within parentheses, for example, (host-variable, host-variable, ...) = (expression, expression, ...), the first value is assigned to the first host variable in the list, the second value to the second host variable in the list, and so on.
(host-variable, host-variable) = (VALUES(expression, NULL)) (host-variable, host-variable) = (expression, NULL)
Local special registers can be referenced only in a VALUES host-variable statement that results in the assignment of a single host variable and not those that result in setting more than one value.
Special registers that can be defined to a host variable include:
CURRENT DATE | CURRENT PACKAGESET |
CURRENT TIME | CURRENT SERVER |
CURRENT TIMESTAMP | CURRENT SQLID |
CURRENT TIMEZONE | USER |
For example: SET :your-var-name = CURRENT SERVER
The value of CURRENT SQLID can be changed by issuing a SET CURRENT SQLID command. The CURRENT PACKAGESET special register (and the SET CURRENT PACKAGESET command) currently have limited functional support by the XDB Server.
For information about each of these special registers, see Special Registers.