DROP VARIABLE

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 14.1 and above

Drops a temporary variable.

Syntax

DROP TEMPORARY VARIABLE [ IF EXISTS ] variable_name

Parameters

  • variable_name

    The name of an existing variable. The variable name may be optionally qualified with session or system.session.

  • IF EXISTS

    If specified, no exception is thrown when the function does not exist.

Examples

-- Declare and drop a temporary variable
> DECLARE VARIABLE myvar;
> DROP TEMPORARY VARIABLE myvar;

-- A temporary variable can be qualified
> DROP TEMPORARY VARIABLE IF EXISTS session.myvar;