Choose an SQLSTATE code

The syserrors system catalog table holds custom messages for DataBlade® modules and UDRs. A unique SQLSTATE value identifies each row in the syserrors system catalog table. Therefore, to store a custom message in syserrors, you assign it an SQLSTATE value.

You must ensure that this SQLSTATE value is unique within syserrors. When you choose an SQLSTATE value, keep the following restrictions in mind:
  • The database server has its own set of system messages.

    Messages that the database server provides are not stored in the syserrors system catalog table. However, any special modules that are included with the database server (such as R-tree support) might have their own messages in syserrors.

  • SQL reserves various SQLSTATE codes for its own use.

    These messages are not stored in the syserrors table.

  • All SQLSTATE values for warnings begin with the 01 class code.

    To define a custom warning message, you must define an SQLSTATE value that has a 01 class code and an unused subclass code.

  • An installed DataBlade module might have stored its messages in syserrors.

    When a DataBlade module is installed, associated messages might be added to syserrors. Avoid the use of any SQLSTATE values that an installed DataBlade module might use. You must also take care not to delete installed messages, or they must be recreated by a restore from a backup or a reinstallation.

  • If you are developing a DataBlade module, coordinate your SQLSTATE values with other DataBlade modules that you are using.

    You can group warnings and errors for your DataBlade modules into the same class code, each with a different subclass code.

You can use the following query to determine the current list of SQLSTATE message strings in syserrors:
SELECT sqlstate, locale, message FROM syserrors
ORDER BY sqlstate, locale;

The locale column is used for the internationalization of error and warning messages.