SQLSTATE codes are required for entry level ANSI SQL compliance, and provide diagnostic infomration about warnings and exceptions.
Warnings – conditions that require user notification but are not serious enough to prevent a SQL statement from executing successfully
Exceptions – conditions that prevent a SQL statement from having any effect on the database
Each SQLSTATE code consists of a 2-character class followed by a 3-character subclass. The class specifies general information about error type. The subclass specifies more specific information.
SQLSTATE codes are stored in the sysmessages system table, along with the messages that display when these conditions are detected. Not all SAP ASE error conditions are associated with a SQLSTATE code—only those mandated by ANSI SQL. In some cases, multiple SAP ASE error conditions are associated with a single SQLSTATE value.