DROP TEMPORARY VARIABLE
Description
The DROP TEMPORARY VARIABLE
statement drops a temporary variable. An exception will
be thrown if the variable does not exist.
Syntax
DROP TEMPORARY VARIABLE [ IF EXISTS ] variable_name
Parameters
-
variable_name
Specifies the name of an existing variable. The function name may be optionally qualified with a
system.session
orsession
.Syntax:
[ system. [ session.] ] variable_name
-
IF EXISTS
If specified, no exception is thrown when the variable does not exist.
Examples
-- Create a temporary variable var1
DECLARE VARIABLE var1 INT;
-- Drop temporary variable
DROP TEMPORARY VARIABLE var1;
-- Try to drop temporary variable which is not present
DROP TEMPORARY VARIABLE var1;
Error: VARIABLE_NOT_FOUND
The variable `system`.`session`.`var1` cannot be found.
-- Drop temporart variable if it exists
DROP TEMPORARY VARIABLE IF EXISTS var1;