For all server character sets except KANJI1, CHARACTER_LENGTH returns the length of string_expression in characters.
If the string_expression argument is null, the result is null.
For KANJI1, the following results are obtained.
FOR this client character set … | CHARACTER_LENGTH returns … |
---|---|
KanjiEBCDIC | the length of string_expression as the number of bytes. A mix of single and multibyte characters is expected. If any Shift-Out/Shift-In characters are present, they are included in the result count. |
KanjiEUC KanjiShift-JIS |
the length of string_expression as the number of logical characters, based on the client session character set. A mix of single and multibyte characters is expected. |
ASCII EBCDIC |
the length of string_expression as the number of bytes. |
KANJI1 support is deprecated. KANJI1 is not allowed as a default character set; the system changes the KANJI1 default character set to the UNICODE character set. Creation of new KANJI1 objects is highly restricted. Although many KANJI1 queries and applications may continue to operate, sites using KANJI1 should convert to another character set as soon as possible. For more information, see KANJI1 Character Set in International Character Set Support, B035-1125.
Because trailing pad characters are considered characters, the length of the value in a CHARACTER column is always equal to the length defined for the column.
The length of the value in a VARCHAR or CLOB column is always equal to the number of characters, including any trailing pad characters, contained in that value.