ZetaSQL specifies the syntax for the variable statements SET
and
UNSET
.
There are three primary variable types: runtime variables, query parameters, and
system variables. Each can be set and unset with the SET
and UNSET
commands.
Additionally, query parameters are prefixed with a single @ symbol and system
variables are prefixed with @@.
The variable names must be valid sql identifiers.
Sets a variable.
SET runtime_variable = constant_value;
SET @query_parameter = constant_value;
SET @@system_variable = constant_value;
Unsets a variable.
UNSET runtime_variable;
UNSET @query_parameter;
UNSET @@system_variable;