LENGTH()

All functions > STRING > LENGTH()

Returns the number of characters in a string.

Signatures

Returns: Number of characters in the string

LENGTH(string: VARCHAR) → BIGINT
sql
ParameterTypeRequiredDescription
stringVARCHARYesInput string to measure

Notes

  • Counts every character position in the string—letters, digits, spaces, symbols, and emoji each add one
  • LENGTH('') is 0; if the input is NULL the result is NULL (use NULL(VARCHAR); bare NULL fails inference)
  • Aliases: LEN, SIZE (same function)

Aliases

  • LEN

  • SIZE

Examples

FeatureQL
SELECT
    f1 := LENGTH('Hello World'), -- Basic string length
    f2 := LENGTH('ABC'), -- Short string
    f3 := LENGTH('  spaces  '), -- Spaces are counted
    f4 := LENGTH('😀😁'), -- Emoji characters
    f5 := LENGTH('€100'), -- Euro symbol counts as 1
    f6 := LEN('test'), -- Using alias LEN
    f7 := SIZE('x'), -- Using alias SIZE
    f8 := LENGTH(NULL(VARCHAR)) -- NULL string yields NULL
;
Result
f1 BIGINTf2 BIGINTf3 BIGINTf4 BIGINTf5 BIGINTf6 BIGINTf7 BIGINTf8 BIGINT
113102441NULL

Last update at: 2026/05/26 17:22:09