The SET CURRENT LOCALE LC_MESSAGES statement changes the
value of the CURRENT LOCALE LC_MESSAGES special register.
This statement is not under transaction control.
Invocation
This statement can be embedded
in an application program or issued interactively. It is an executable
statement that can be dynamically prepared.
Authorization
None required.
Syntax
.-=-.
>>-SET--CURRENT LOCALE LC_MESSAGES--+---+--+-host-variable---+-><
'-string-constant-'
Description
The
CURRENT LOCALE LC_MESSAGES special register identifies the locale
that is used by EVMON_UPGRADE_TABLES, as well as monitoring routines
in the monreport module. EVMON_UPGRADE_TABLES and the monitoring
routines use the value of CURRENT LOCALE LC_MESSAGES to determine
in which language the result set text output should be returned. User-defined
routines that are coded to return messages could also use the value
of CURRENT LOCALE LC_MESSAGES to determine what language to use for
message text.
- host-variable
- A variable of type CHAR or VARCHAR. It cannot be set to null.
- string-constant
- A character string constant.
Notes
- Initial value: The initial value of the CURRENT
LOCALE LC_MESSAGES special register is 'en_US'.
- Language
availability: If the language for the locale is not available
to the database manager, messages will be returned in English.
- Code page compatibility: The language for the locale
specified must be supported by the code page of the output parameter
or returns type of a routine that uses the special register to determine
what language to return message text information in. If the database
is not a Unicode database (and the routine was not created with PARAMETER
CCSID UNICODE) and some characters in the language for the locale
cannot be represented in the database code page, substitution characters
will be returned as a result of code page conversion.
- Potential future use: In a future release, the value
of the CURRENT LOCALE LC_MESSAGES special register might be used for
other areas of the database environment that involve messages.
- Valid locales and naming: For information about
valid locales and their naming, see "Locale names for SQL and XQuery"
Examples
- Example 1: The following statement sets the CURRENT
LOCALE LC_MESSAGES special register to the English (Canada) locale
using the latest version of Common Locale Data Repository (CLDR) available
in the database manager.
SET CURRENT LOCALE LC_MESSAGES = 'en_CA'
- Example 2: The following statement sets the CURRENT LOCALE
LC_MESSAGES special register to the French (France) locale using Common
Locale Data Repository (CLDR) version 1.5. The CONNECTION routine
in the monreport module is then invoked to have its output
returned in French.
SET CURRENT LOCALE LC_MESSAGES = 'CLDR 1.5:fr_FR'
CALL MONREPORT.CONNECTION
- Example 3: Assume that the user-defined procedure XYZ.STORELOCATOR
takes a zip code or postal code input. It returns a result set of
stores of the XYZ company within a 30 minute drive from the zip code
or postal code given as input. If the zip code or postal code is not
in the correct format, an error message is returned that indicates
what the problem is with the format. The procedure is coded to be
able to return the error message in the language determined from the
value of the CURRENT LOCALE LC_MESSAGES special register. The following
statement sets the CURRENT LOCALE LC_MESSAGES special register to
the Spanish (Mexico) locale. The store locator user-defined procedure
is then invoked and any error messages will be returned in Spanish.
SET CURRENT LOCALE LC_MESSAGES = 'es_MX'
CALL XYZ.STORELOCATOR(:ZIP, :STATUSMSG)