CONCAT(...)

All functions > STRING > CONCAT(...)

Returns a single concatenated string from a list of strings.

Syntax

CONCAT(string, string, …)  ·  CONCAT_FN(ARRAY[…])

Function form

Returns: Concatenated string

CONCAT_FN(strings: ARRAY(VARCHAR)) → VARCHAR
sql
ParameterTypeRequiredDescription
stringsARRAY(VARCHAR)YesStrings to concatenate in order

Notes

  • Variadic CONCAT(a, b, …) is implemented the same way as CONCAT_FN(ARRAY[…])
  • Every argument must be VARCHAR: bare NULL is untyped and fails inference—use NULL(VARCHAR) or COALESCE(expr, '')
  • A NULL piece makes the result NULL (SQL || semantics). Use COALESCE(piece, '') for an empty segment, or CONCAT_WS, which skips NULL pieces
  • No separator between pieces; use CONCAT_WS for a delimiter
  • For binary left || right (and left-associative chains), see Related operators (||)

Examples

CONCAT(...)

FeatureQL
RETURN
    -- Several pieces
    f1 := CONCAT('A', 'B', 'C'),
    -- Includes a space argument
    f2 := CONCAT('Hello', ' ', 'World')
;
Result
f1 VARCHARf2 VARCHAR
ABCHello World

Edge cases

FeatureQL
RETURN
    -- NULL propagates
    f1 := CONCAT('A', NULL::VARCHAR, 'B')
;
Result
f1 VARCHAR
NULL

CONCAT_FN(...)

FeatureQL
RETURN
    -- Array of pieces
    f1 := CONCAT_FN(ARRAY('A', 'B', 'C')),
    -- Spaces as separate elements
    f2 := CONCAT_FN(ARRAY('Hello', ' ', 'World'))
;
Result
f1 VARCHARf2 VARCHAR
ABCHello World

.CONCAT(...) — chained

FeatureQL
RETURN
    -- Chained variadic call on a VARCHAR base
    f1 := 'A'.CONCAT('B', 'C')
;
Result
f1 VARCHAR
ABC

CONCAT_FN — Edge cases

FeatureQL
RETURN
    -- Single element
    f1 := CONCAT_FN(ARRAY('One')),
    -- NULL propagates
    f2 := CONCAT_FN(ARRAY('A', NULL::VARCHAR, 'B'))
;
Result
f1 VARCHARf2 VARCHAR
OneNULL