SQLCODE_INFO table function
The SQLCODE_INFO table function returns the SQL message associated with the specified SQLCODE value.
Every non-zero SQLCODE returned by a Db2 for i operation corresponds to a message in the QSQLMSG message file. This table function returns the message identifier and message text that is associated with a specific SQLCODE.
Authorization: See Note below.
- sqlcode
- An integer value that represents a positive (warning) or negative (error) SQLCODE.
Column Name | Data Type | Description |
---|---|---|
MESSAGE_ID | CHAR(7) | The message identifier that corresponds to the SQLCODE. |
MESSAGE_TEXT | VARGRAPHIC(132) CCSID 1200 | The text of the message. |
MESSAGE_SECOND_LEVEL_TEXT | VARGRAPHIC(3000) CCSID 1200 | The second-level message text of the message. |
Note
This function is provided in the SYSTOOLS schema as an example of finding a specific message in a message file. Similar to other Db2® for i provided tools within SYSTOOLS, the SQL source can be extracted and used as a model for building similar helper functions, or to create a customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces used to implement the service. To understand the authority requirements, extract the SQL for the service and examine the implementation.
Example
SELECT * FROM TABLE(SYSTOOLS.SQLCODE_INFO(-204));