Insert customized exception messages

You can store customized status codes and their associated messages in the syserrors system catalog table.

To create a customized exception message, insert a row directly in the syserrors table. The syserrors table provides the following columns for a globalized exception message.
Column name Description
sqlstate The SQLSTATE value that is associated with the exception 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
For more information about how to determine SQLSTATE values, see the HCL OneDB™ DataBlade® API Programmer's Guide.
message The text of the exception message, with characters in the code set of the target locale By convention, do not include any newline characters in the message.
locale The locale with which the exception message is to be used The locale column identifies the language and code set used for the globalization of error and warning messages. This name is the name of the target locale of the message text.

For more information about the syserrors system catalog table, see the topics that describe the system catalog in the HCL OneDB Guide to SQL: Reference. Do not allow any code-set conversion when you insert the text in syserrors.

If the code sets of the client and database locales differ, temporarily set both the CLIENT_LOCALE and DB_LOCALE environment variables in the client environment to the name of the database locale. This workaround prevents the client application from performing code-set conversion.

If you specify any parameters in the message text, include only ASCII characters in the parameter names, so that the parameter name can be the same for all locales. Most code sets include the ASCII characters. For example, the following INSERT statements insert new messages in syserrors whose SQLSTATE value is "03I01":
INSERT INTO syserrors VALUES ("03I01", "en_us.8859-1", 0, 1, 
      "Operation Interrupted.")
INSERT INTO syserrors VALUES ("03I01", "fr_ca.8859-1", 0, 1, 
      "Traitement Interrompu.")

The '03I01' SQLSTATE value now has two locale-specific messages. The database server chooses the appropriate message based on the server-processing locale of the UDR when it executes. For more information about how mi_db_error_raise( ) locates an exception message, see Search for customized messages.