How to look up SQL error codes quickly in DB2

Quite regularly DB2 complains about my SQL statements and usually returns a cryptic error message including an even more cryptic SQL error code. What I normally do in those situations is looking up the error code in the DB2 Information Center, which takes some time. I just found out that there is an easier way to get at least a short explanation of what an error code means. For example, to look up the error code -161, you can use the following SQL query:

VALUES SQLERRM(-161)

Result:

1
------------------------------------------------------------------------------------------------------
SQL0161N  The resulting row of the insert or update operation does not conform to the view definition.

Nice.

This entry was posted in DB2. Bookmark the permalink.

2 Responses to How to look up SQL error codes quickly in DB2

  1. Bill Tucker says:

    I prefer this from the command line: db2 ? sql-161

    alternatively: db2 ? sql161N

  2. Pingback: Db2 Error -4499 | autoqoute.com

Leave a Reply

Your email address will not be published. Required fields are marked *