CHARACTERS
Purpose
Returns an integer value representing the number of logical characters or bytes contained in the specified operand string.
Syntax
where:
Syntax element … |
Specifies … |
string_expression |
a character (single byte, multibyte, mixed single byte and multibyte) string for which the number of characters is to be returned. The data types for string_expression are restricted to CHARACTER, VARCHAR, and CLOB. |
ANSI Compliance
This is a Teradata extension to the ANSI SQL:2011 standard.
Value Returned by CHARACTERS and Server Character Set
Because CHARACTERS returns the number of logical characters or bytes in string_expression, the value differs depending on the server character set of string_expression. The following table illustrates the differences among the various character sets for a CHARACTER(12) column.
FOR this server character set … |
The length of string_expression … |
|
is always 12. Unicode, Latin, and Graphic are fixed width character types. |
|
varies depending on the mix of characters (multibyte and single byte) in the string. KanjiSJIS and KANJI1 are variable width character sets. |
CHARACTER_LENGTH versus CHARACTERS
Use of the CHARACTERS function is deprecated. Instead, use the ANSI‑equivalent “CHARACTER_LENGTH.”