prorm API Reference
    Preparing search index...

    Function sqlSubstring

    • Extract a substring.

      • Oracle, DB2, SQLite: use SUBSTR(expr, start, length). SQLite has no built-in SUBSTRING function (only substr); Oracle/DB2 use SUBSTR as their canonical name (both also happen to accept the same argument order as the standard SUBSTRING(expr, start, length) form).
      • MSSQL: SUBSTRING(expr, start, length), but MSSQL requires the length argument. When length is omitted, LEN(expr) is used as a safe upper bound so the result runs to the end of the string.
      • MySQL, MariaDB, Postgres, CockroachDB, Redshift, Snowflake, ClickHouse: SUBSTRING(expr, start, length) comma-argument form, length optional.

      Parameters

      • dialect: Dialect
      • expr: StringSqlExpr

        The column/expression to extract from.

      • start: number

        1-based start position (SQL substring indices are 1-based).

      • Optionallength: number

        Optional number of characters to extract.

      Returns LiteralExpression & { $literal: string }