prorm API Reference
    Preparing search index...

    Function lpad

    • Left-pad a string to a target length.

      • MySQL, MariaDB, Postgres, CockroachDB, Redshift, Oracle, Snowflake: native LPAD(expr, length, pad).
      • ClickHouse: native leftPad(expr, length, pad).
      • MSSQL: has no LPAD. Workaround using RIGHT(REPLICATE(pad, length) + expr, length) — replicate the pad string enough times to guarantee at least length characters, prepend it to expr, then take the rightmost length characters (matches LPAD's truncate-on-overflow semantics).
      • DB2: has no LPAD in Db2 for LUW. Workaround using a CASE expression: if the string is already >= target length, return it unchanged; otherwise prepend enough of the repeated pad string (via REPEAT + SUBSTR) to reach the target length.
      • SQLite: throws. SQLite has neither LPAD nor a REPEAT function, and there is no safe single-expression workaround without a recursive CTE, so this is not something a scalar SQL fragment can express correctly.

      Parameters

      Returns LiteralExpression & { $literal: string }