CHARACTER_LENGTH Function

Returns the number of characters in a string of any data type.

Category: Character
Alias: CHAR_LENGTH
Returned data type: BIGINT
Note: The CHARACTER_LENGTH function counts trailing blanks. If you do not want to count trailing blanks, then you must use the TRIM Function to remove them.

Syntax

CHARACTER_LENGTH(expression)

Arguments

expression

specifies any valid expression.

Data type All data types are valid.
See <sql-expression>
FedSQL Expressions

Comparisons

The CHARACTER_LENGTH function returns the number of characters in a character string, but counts a multibyte character as a single character. The OCTET_LENGTH function counts a multibyte character as multiple characters.

Example

The following statements illustrate the CHARACTER_LENGTH function:
Statements
Results
select character_length('December');
8
select character_length('FedSQL ');
7

See Also

Last updated: February 23, 2017