SET CURRENT LOCALE LC_CTYPE

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

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

Read syntax diagram
                   .-LOCALE-.              .-=-.   
>>-SET--+-CURRENT--+--------+--LC_CTYPE-+--+---+---------------->
        '-CURRENT_LC_CTYPE--------------'          

>--+-string-constant-+-----------------------------------------><
   '-host-variable---'   

Description

Start of changeThe value of CURRENT LOCALE LC_CTYPE is replaced by the value specified.End of change

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

Start of changeA locale can be specified in uppercase characters, lowercase characters, or a combination of the two. For more information, see CURRENT LOCALE LC_CTYPE.End of change

Note: Start of changeThe 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.End of change

Examples

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;