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

SQL Anywhere 12.0.1 » SQL Anywhere Server - SQL Reference » SQL language elements



SQL Anywhere supports three levels of variables:

  • Local variables   These are defined inside a compound statement in a procedure or batch using the DECLARE statement. They exist only inside the compound statement.

  • Connection-level variables   These are defined with a CREATE VARIABLE statement. They belong to the current connection, and disappear when you disconnect from the database or when you use the DROP VARIABLE statement.

  • Global variables   These are system-supplied variables that have system-supplied values. All global variables have names beginning with two @ signs. For example, the global variable @@version has a value that is the current version number of the database server. Users cannot define global variables.

Local and connection-level variables are declared by the user, and can be used in procedures or in batches of SQL statements to hold information. Global variables are system-supplied variables that provide system-supplied values.

 See also
 Standards and compatibility

Local variables
Connection-level variables
Global variables