SQL Getting Started

Investigating Errors

Whenever you make a mistake typing in any of the examples, or if an error occurs during execution of an SQL statement, the database manager returns an error message. The error message consists of a message identifier, a brief explanation, and an SQLSTATE.

SQLSTATE errors are error codes common to the DB2 family of products. SQLSTATE errors conform to the ISO/ANSI SQL92 standard.

For example, if the user ID or password had been incorrect in the CONNECT statement, the database manager would have returned a message identifier of SQL1403N and an SQLSTATE of 08004. The message is as follows:

     SQL1403N The username and/or password supplied is
              incorrect.   SQLSTATE=08004

You can get more information about the error message by typing a question mark (?) then the message identifier or the SQLSTATE:

        ? SQL1403N
OR
        ? SQL1403
OR
        ? 08004

Note that the second last line in the description of the error SQL1403N states that the SQLCODE is -1403. SQLCODE is a product specific error code. Message identifiers ending with N (Notification) or C (Critical) represent an error and have negative SQLCODEs. Message identifiers ending with W (Warning) represent a warning and have positive SQLCODEs.


[ Top of Page | Previous Page | Next Page ]