SQLSTATE and SQLCODE considerations

  • Using SQLSTATE causes performance overhead because of the representation of SQLSTATE as five characters. The overhead is most noticeable with short SQL statements and in error situations.

  • Mapping SQLSTATE values to SQLCODE values can result in ambiguous SQLCODE values:

    • SQLCODE values will often not map to a unique SQLSTATE value. For example, see the many SQLCODE values mapped to SQLSTATE 42000 in SQLSTATE values.

    • To deal with the problem of ambiguous SQLCODE values, Hewlett Packard Enterprise recommends retrieving the error message text or the SQLCODE value in addition to the SQLSTATE.

  • SQLSTATE values for some SQL/MX error and warning messages might be subject to change:

    • In the future, NonStop SQL/MX might return different SQLSTATE values for error conditions than it does now.

    • In the future, SQL/MX error handling might use a different error path, and therefore return a slightly different SQLCODE and implementation-defined SQLSTATE value for an error.