SET CURRENT LOCALE LC_CTYPE statement
The SET CURRENT LOCALE LC_CTYPE statement assigns a value to the CURRENT LOCALE LC_CTYPE special register. The special register allows control over the LC_CTYPE locale for statements that use a built-in function that refers to a locale, such as LCASE, UCASE, and TRANSLATE (with a single argument).
Invocation for SET CURRENT LOCALE LC_CTYPE
This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.
Authorization for SET CURRENT LOCALE LC_CTYPE
None required.
Syntax for SET CURRENT LOCALE LC_CTYPE
Description for SET CURRENT LOCALE LC_CTYPE
The value of CURRENT LOCALE LC_CTYPE is replaced by the value specified.
- string-constant
- A character string constant that must not be longer than 50 bytes and must represent a valid locale.
- host-variable
- A variable with a data type of CHAR or VARCHAR and a length that is not longer than 50 bytes.
The value of host-variable must not be null and must represent a valid
locale. If the host variable has an associated indicator variable, the value of the indicator
variable must not indicate a null value.
The locale must:
- Be left justified within the host variable
- Be padded on the right with blanks if its length is less than that of the host variable
A locale can be specified in uppercase characters, lowercase characters, or a combination of the two. For more information, see CURRENT LOCALE LC_CTYPE.
Note: The existence of a locale is not validated when the
CURRENT LOCALE LC_CTYPE special register is set. For example, a locale name that is misspelled is
not detected, which could affect the way subsequent SQL operates. When the special register value is
used at execution time, an error is returned if the locale does not exist. For example, if the LOWER
function is invoked without specifying a locale name, the special register determines the locale
that is used.
Examples for SET CURRENT LOCALE LC_CTYPE
Example 1: Set the CURRENT LOCALE LC_CTYPE special register to the locale 'En_US'.
EXEC SQL SET CURRENT LOCALE LC_CTYPE = 'En_US';
Example 2: Set the CURRENT LOCALE LC_CTYPE special register to the value of host variable
HV1, which contains 'Fr_FR@EURO'.
EXEC SQL SET CURRENT LOCALE LC_CTYPE = :HV1;