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

LEFT

Syntax

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

Purpose

The LEFT SQL function extracts a substring from a text using characters from the left side. The original input text is provided when the text has less characters than the desired length.

Parameters:

  • Input (varchar2): text to extract substring from.
  • Length (int32): maximum length of the substring.

Returns: substring from the left side of the input as a varchar2.

Examples

The following example retrieves the left three characters of a text:

select left('abcdefg', 3)

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

The following example retrieves the left nine characters of a text:

select left('abcdefg', 9)

----------------
abcdefg