Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

CHAR_LENGTH Function

Description

The CHAR_LENGTH function returns the number of characters in a character string. It is used to calculate the length of a CHAR, NCHAR, VARCHAR or VARNCHAR (and the synonym of such data type) string.

Syntax

CHAR_LENGTH ( length_operand )

length_operand :
character string
NULL

  • length_operand : Specifies the character string whose number of characters is to be calculated. If the character string is NULL, NULL is returned. The length of the character string is calculated in characters and returned as an integer value. Space characters in the character string are also reflected in the return value. The single quote used to represent a character string is not considered for the calculation.
Example

The following is an example that returns countries whose names consist of 15 - 16 characters from the nation table.

SELECT CHAR_LENGTH(name), name
FROM nation
WHERE CHAR_LENGTH(name) BETWEEN 15 AND 16
ORDER BY 1 ASC;

Result :

15 'Solomon Islands'
16 'Papua-New Guinea'