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

RPAD

Syntax

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

Purpose

The RPAD SQL function pads the right-side of a text with a specific set of characters to the given length. When no set of characters given, it will pad with a whitespace.

See also LPAD.

Parameters:

  • Input (varchar2): Text to be padded.
  • Length (int32): The length to make the input to, from 0 to 67,108,864.
  • Pad text (optional, varchar2): Text to add to the input if the length is larger than the input. Defaults to a space (' ').

Returns: the padded text, or null if the text cannot be padded.

Examples

The following example pads hello to a length of ten characters with *:

select rpad('hello', 10, '*')

-------------------
hello*****

The following example pads hello to a length of ten characters with spaces:

select rpad('hello', 10)

-------------------
hello     

The following example shortens hello to a length of three characters since the requested length is less than the length of the input:

select rpad('hello', 3)

-------------------
hel