Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Drops a SQL variable.
DROP VARIABLE [ IF EXISTS ] identifier
DROP DATABASE VARIABLE [ IF EXISTS ] [ owner.]identifier
A valid identifier for the variable.
Specify the owner of the database-scope variable. If owner is not specified, the database server looks for a database-scope variable named identifier owned by the user executing the statement. If none is found, the database server looks for a database-scope variable named identifier owned by PUBLIC.
Specify this clause to allow the statement to complete without returning an error if a variable with the specified name (and/or owner, if specified) is not found.
The DROP VARIABLE statement drops a SQL variable.
Connection-scope variables are also automatically dropped when the database connection is terminated. Database-scope variables must be explicitly dropped.
If a statement is still accessing a database-scope variable at the time it is dropped, then the variable is still available in memory for that statement only.
Variables are often used for large objects, so dropping them after use or setting them to NULL can free up significant resources such as disk space and memory.
Connection-scope variables: No privileges are required to drop a connection-scope variable.
Database-scope variables: No privileges are required to drop a self-owned database-scope variable. To drop a database-scope variable owned by another user or by PUBLIC, you must have the MANAGE ANY DATABASE VARIABLE system privilege.
Connection-scope variables: No side effects are associated with dropping a connection-scope variable.
Database-scope variables: Dropping a database-scope variable causes an automatic commit.
Not in the standard.