The LOWER function returns a string in which all characters have been converted to lowercase characters using the rules associated with the specified locale.
>>-LOWER--(--string-expression--,--locale-name--+---------------+--+--------------------+--)->< '-,--code-units-' '-,--+-CODEUNITS16-+-' +-CODEUNITS32-+ '-OCTETS------'
The schema is SYSIBM.
CODEUNITS16 specifies that code-units is expressed in 16-bit UTF-16 code units. CODEUNITS32 specifies that code-units is expressed in 32-bit UTF-32 code units. OCTETS specifies that code-units is expressed in bytes.
If a string unit is not explicitly specified, the string unit of string-expression determines the unit that is used. For more information about CODEUNITS16, CODEUNITS32, and OCTETS, see "String units in built-in functions" in "Character strings".
The result of the function is VARCHAR if string-expression is CHAR or VARCHAR, and VARGRAPHIC if string-expression is GRAPHIC or VARGRAPHIC. The string units of the result is the same as the string units of string-expression.
The length attribute of the result is determined by the implicit or explicit value of code-units, the implicit or explicit string unit, the result data type, and the result string units, as shown in the following table:
| Data type and string units of result | Length attribute for code-units in CODEUNITS16 | Length attribute for code-units in CODEUNITS32 | Length attribute for code-units in OCTETS |
|---|---|---|---|
| VARCHAR in OCTETS | MIN(code-units * 3, 32672) | MIN(code-units * 4, 32672) | code-units |
| VARCHAR in CODEUNITS32 | MIN(code-units / 2, 8168) | MIN(code-units, 8168) | MIN(code-units / 4, 8168) |
| VARGRAPHIC in CODEUNITS16 or double bytes | code-units | MIN(code-units * 2, 16336) | MIN(code-units / 2, 16336) |
| VARGRAPHIC in CODEUNITS32 | MIN(code-units / 2, 8168) | MIN(code-units, 8168) | MIN(code-units / 4, 8168) |
The actual length of the result might be greater than the length of string-expression. If the actual length of the result is greater than the length attribute of the result, an error is returned (SQLSTATE 42815). If the number of code units in the result exceeds the value of code-units, an error is returned (SQLSTATE 42815).
If string-expression is not in UTF-16, this function performs code page conversion of string-expression to UTF-16, and of the result from UTF-16 to the code page of string-expression. If either code page conversion results in at least one substitution character, the result includes the substitution character, a warning is returned (SQLSTATE 01517), and the warning flag SQLWARN8 in the SQLCA is set to 'W'.
If the first argument can be null, the result can be null; if the first argument is null, the result is the null value.
SELECT LOWER(JOB, 'en_US')
FROM EMPLOYEE
WHERE EMPNO = '000020'
The result is the value
'manager'. VALUES LOWER('Iİıi', 'tr_TR', CODEUNITS16)
The
result is the string 'ıiıi'.