---
title: "LPAD"
description: "The LPAD SQL function pads a text to the left to make it a specified length."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/lpad
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/lpad
updated: 2026-10-08T00:00:00Z
license: https://documentation.invantive.eu/en/
---

## Syntax
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> LPAD[LPAD]:::quoted
    LPAD --> End((END))
```

## Purpose
The `LPAD` SQL function pads a text to the left to make it a specified length.

See also [[RPAD]].

Parameters:
- Input (`varchar2`): text to be padded.
- Length (`int32`): the length the text should be padded to, from 0 to 67,108,864.
- Characters (optional, `varchar2`): Characters to pad with. Defaults to a space.

Returns: A text padded to the left to a given length with the optional specified characters.

## Examples
The following example pads `abc` to a length of five characters with spaces:
```sql
select lpad('abc', 5)

-------------------
  abc
```
The following example pads `abc` to a length of five characters with `*`:
```sql
select lpad('abc', 5, '*')

-------------------
**abc
```
The following example shortens `abc` to a length of one character since the requested length is less than the length of the input:
```sql
select lpad('abc', 1)

-------------------
a
```