CHAR_LENGTH / CHARACTER_LENGTH

Syntax for these functions is as follows:

CHAR_LENGTH | CHARACTER_LENGTH ( <character-expression> )

Returns the length in characters of the string passed as the input argument. Returns null if input argument is null.

Examples

Expression Result
CHAR_LENGTH(‘one’) 3
CHAR_LENGTH('') 0
CHARACTER_LENGTH(‘fred’) 4
CHARACTER_LENGTH( cast (null as varchar(16) ) null
CHARACTER_LENGTH( cast (‘fred’ as char(16) ) 16

Limitations

Note: SQLstream streaming SQL does not support the optional USING CHARACTERS | OCTETS clause. This is a departure from the SQL standard.