ERRORMSG Function [Miscellaneous]

Provides the error message for the current error, or for a specified SQLSTATE or SQLCODE value.

Syntax

ERRORMSG ( [ sqlstate | sqlcode ] )
sqlstate: string
sqlcode: integer

Parameters

Parameters

Parameter

Definition

sqlstate

The SQLSTATE value for which the error message is to be returned.

sqlcode

The SQLCODE value for which the error message is to be returned.

Returns

A string containing the error message.

VARCHAR

Example

The following statement returns the error message for SQLCODE -813:

select errormsg( -813 )

Return Value

A string containing the error message. If no argument is supplied, the error message for the current state is supplied. Any substitutions (such as table names and column names) are made.

If an argument is supplied, the error message for the supplied SQLSTATE or SQLCODE is returned, with no substitutions. Table names and column names are supplied as placeholders ('???').

The ERRORMSG function returns SQL Anywhere and Sybase IQ error messages.

Standards and Compatibility

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Not supported by Adaptive Server Enterprise.