Chapter 6 SQL Language Elements
253
CREATE PROCEDURE VersionProc ( OUT ver
VARCHAR( 100 ) )
BEGIN
SELECT @@version
INTO ver;
END
In Embedded SQL, global variables can be selected into a host variable list.
The following table lists the global variables available in Adaptive Server
Anywhere
Variable name Meaning
@@dbts
A value of type TIMESTAMP representing the last generated
value used for a column defined with DEFAULT
TIMESTAMP.
@@error
Commonly used to check the error status (succeeded or
failed) of the most recently executed statement. It contains 0
if the previous transaction succeeded; otherwise, it contains
the last error number generated by the system. A statement
such as if
@@error != 0 return causes an exit if an error
occurs. Every SQL statement resets @@error, so the status
check must immediately follow the statement whose success
is in question.
@@identity
Last value inserted into an IDENTITY or DEFAULT
AUTOINCREMENT column by an INSERT or SELECT
INTO statement.
$ For a description, see "@@identity global variable" on
page 257.
@@isolation
Current isolation level. @@isolation takes the value of the
active level.
List of global
variables