invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

LPAD

Syntax

%%{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:

select lpad('abc', 5)

-------------------
  abc

The following example pads abc to a length of five characters with *:

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:

select lpad('abc', 1)

-------------------
a