SQLSTATE_INFO table
The SQLSTATE_INFO table returns information about SQLSTATE values used by Db2 for i and the corresponding SQLCODEs.
Some SQLSTATEs are defined to have more than one SQLCODE. Some SQLCODEs are associated with more than one SQLSTATE. A SQLSTATE that does not have an associated SQLCODE is not included in the table.
Authorization: None required.
The following table describes the columns in the table. The system name is STATE_INFO. The schema is QSYS2.
| Column Name | System Column Name | Data Type | Description |
|---|---|---|---|
| SQLSTATE_VALUE | STATE | CHAR(5) | A value that indicates an SQL error or warning condition. |
| SQLCODE_VALUE | CODE | INTEGER | A SQLCODE that corresponds to the SQLSTATE value. This value generally has an associated message in the QSQLMSG message file. The SYSTOOLS.SQLCODE_INFO table function can be used to retrieve the message text. |
| SQLSTATE_DETAIL | STATE_DTL | VARCHAR(1000) | Descriptive detail text for the SQLSTATE. This text is always in English. |
Examples
Return information about SQLSTATE 42704.
SELECT * FROM QSYS2.SQLSTATE_INFO
WHERE SQLSTATE_VALUE = '42704';
Return information about SQLSTATE 55019, including the message text related to the SQLCODE. One row is returned for each SQLCODE associated with this SQLSTATE.
SELECT * FROM QSYS2.SQLSTATE_INFO,
TABLE (SYSTOOLS.SQLCODE_INFO(SQLCODE_VALUE))
WHERE SQLSTATE_VALUE = '55019';
