Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

DROP VARIABLE statement

Drops a SQL variable.

Syntax
  • Drop a connection-scope variables:
    DROP VARIABLE [ IF EXISTS ] identifier
  • Drop a database-scope variables
    DROP DATABASE VARIABLE [ IF EXISTS ] [ owner.]identifier
Parameters
  • identifier

    A valid identifier for the variable.

  • owner

    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.

  • IF EXISTS clause

    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.

Remarks

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.

Privileges

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.

Side effects

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.

Standards
  • ANSI/ISO SQL Standard

    Not in the standard.