LEN

functionsupportedCore SQL functions

docs.snowflake.com ↗

String & binary functions

Returns the length of an input string or binary value. For strings, the length is the number of characters, and UTF-8 characters are counted as a single character. For binary, the length is the number of bytes.

Syntax

LENGTH( <expression> )

LEN( <expression> )

Parameters

NameRequiredDescription
expressionrequiredThe input expression must be a string or binary value.

Returns

The returned data type is INTEGER (more precisely, NUMBER(18, 0)).

Collation details

- No impact. In languages in which one character is one letter and vice versa, the LENGTH function behaves the same with and without collation. - In languages where the alphabet contains digraphs or trigraphs (such as “Dz” and “Dzs” in Hungarian), each character in each digraph and trigraph is treated as an independent character, not as part of a single multi-character letter. For example, although Hungarian treats “dz” as a single letter, Snowflake returns 2 for LENGTH(COLLATE('dz', 'hu')).