The following are ODBC system variables. If a server error occurs and the following variables exist, they will be filled in with the information about the error. If an ODBC variable contains multiple errors, the last error will be first. Each ODBC variable is limited to 4096 characters.
ODBC_DELIMITER
The system variable that controls whether the ODBC system variables contain a single error or multiple errors.
If the ODBC_DELIMITER variable exists, is not null, and contains at least one character, then the other ODBC system variables will contain all previous errors separated by the first character of this variable, otherwise they will only contain the last error.
ODBC_ERRORMSG
The system variable that stores the ODBC error messages as Text.
If a server error occurs and the ODBC_ERRORMSG variable exists, it will be filled in with error message text from the server. If the ODBC_DELIMITER variable has a value this will contain multiple errors.
ODBC_SQLSTATE
This TEXT variable is a five character code defined by ODBC.
If a server error occurs and the ODBC_SQLSTATE variable exist, it will be filled in with a five character error code defined by ODBC. If the ODBC_DELIMITER variable has a value then the ODBC_SQLSTATE variable will contain multiple error numbers.
ODBC_NATIVEERROR
This TEXT system variable is the ODBC error number from the server.
If a server error occurs and the ODBC_NATIVEERROR variable exists, it will be filled in with the error number from the server. If the ODBC_DELIMITER variable has a value, then the ODBC_NATIVEERROR variable will contain multiple error numbers.
Define the variables using the SET VARIABLE command as follows, prior to use with ODBC tables.
SET VAR ODBC_DELIMITER TEXT = '_'
SET VAR ODBC_ERRORMSG TEXT
SET VAR ODBC_SQLSTATE TEXT
SET VAR ODBC_NATIVEERROR TEXT