ULENGTH

The ULENGTH function returns an integer value that is equal to the number of UTF-8 characters in a character string argument that is encoded in UTF-8.

The function type is integer.

Format

Read syntax diagramSkip visual syntax diagramFUNCTION ULENGTH(argument-1)
argument-1
Must be of class alphabetic or alphanumeric. argument-1 must contain valid UTF-8 encoded characters.

The returned value is the number of UTF-8 characters in argument-1.

If the UTF-8 argument contains composed characters, the combining characters are counted individually in determining the length. For example, when encoded in UTF-8, the Unicode character ä can be x'C3A4' or x'61CC88'. With either of the UTF-8 characters as argument-1, the returned values of the ULENGTH function are different. See the following table for details.
Table 1. ULENGTH function of character ä
Character Unicode encoding UTF-8 encoding Returned value of the ULENGTH function
ä
U+00E4
(precomposed form,
latin small letter a with diaeresis)
x'C3A4' 1
U+0061 + U+0308
(canonical decomposition,
latin small letter a + combining diaeresis)
x'61CC88' 2