System Variables

Advantage SQL Engine

The Advantage Query Engine maintains two categories of system variables. The first category of the system variable returns information about the current user connection or information about the current query handle. These variables are prefixed with the :: (double colons) followed by either "conn." or "stmt.", short hand for connection or statement (query handle) respectively. The variables in this category are:

The second category of the system variables are maintained by the SQL Script Execution Engine for the purpose of error handling. These variables are denoted by the double underscore-characters, "__", leading the variable name. The variables in this category are __errclass (String), __errcode (Integer), and __errtext (String). These three variables provide information about an exception in the script, either a raised exception or a runtime error. They are local to the current executing SQL script. They cannot be assigned values directly using assignment statements. Instead, their values are initialized when a RAISE statement is executed or when a runtime error is detected. If the exception originates from a RAISE statement, these three variables will be assigned the values provided by the RAISE statement. If the exception is caused by a runtime error, the __errclass variable will be initialized with string value "ADS_SCRIPT_EXCEPTION" and the __errcode and __errtext variables will contain the error code and error text that will be returned to the caller if the exception is not handled.