prorm API Reference
    Preparing search index...

    Function length

    • Get the character length of a string.

      • MySQL, MariaDB, Postgres, CockroachDB, DB2, Snowflake: use CHAR_LENGTH(expr). This is deliberately chosen over LENGTH() on MySQL/MariaDB because LENGTH() there counts BYTES, which is wrong for multi-byte (e.g. UTF-8) text; CHAR_LENGTH() always counts characters.
      • MSSQL: has no CHAR_LENGTH/LENGTH function at all; uses LEN(expr) (already character-counting).
      • Redshift: uses LEN(expr), its documented/idiomatic string-length function (Redshift's SQL dialect favors LEN even though it is Postgres-derived).
      • Oracle: uses LENGTH(expr) (Oracle has no CHAR_LENGTH keyword; LENGTH already counts characters for CHAR/VARCHAR2 data).
      • SQLite: uses length(expr), which for TEXT values already counts characters, not bytes (SQLite has no separate CHAR_LENGTH).
      • ClickHouse: length() counts BYTES. For character-correct behavior with multi-byte text, lengthUTF8(expr) is used instead.

      Parameters

      Returns LiteralExpression & { $literal: string }