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

CONCAT

Syntax

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

Purpose

The CONCAT SQL function concatenates the left and right values together as a varchar2 or blob.

Parameters:

  • Position 1 (varchar2 or blob): a value.
  • Position n (varchar2 or blob): more values.

Returns: concatenation of the parameters. Returns a blob when at least one value is a blob and varchar2 otherwise. A null value is considered an empty text.

The CONCAT SQL function accepts an arbitrary number of parameters, whereas the || operator is used in an infix notation.

Use of CONCAT instead of the || operator is recommended for performance reasons when 50 or more texts are being concatenated together.

Examples

The following example retrieves the concatenation of abc and def:

select concat('abc', 'def')

--------
abcdef

The following example retrieves the concatenation of abc, null and def:

select concat('abc', null, 'def')

--------
abcdef

The following example retrieves the concatenation of abc, null and def using the infix concatenation operator ||:

select 'abc' || null || 'def'

--------
abcdef