All Products
Search
Document Center

MaxCompute:CONCAT

Last Updated:Mar 25, 2026

Concatenates multiple arrays into a new array, or concatenates multiple strings into a new string.

  • Array overload: Returns null if any input array is null. Null elements within an array are included in the result.

  • String overload: Returns null if any input parameter is null or if no parameters are provided.

Syntax

array<T> concat(array<T> <a>, array<T> <b>[,...])
string concat(string <str1>, string <str2>[,...])

Parameters

Array overload

ParameterRequiredTypeDescription
a, bYesARRAYArrays to concatenate. All arrays must contain elements of the same data type. T can be any data type. Null elements are included in the result.

String overload

ParameterRequiredTypeDescription
str1, str2YesSTRINGStrings to concatenate. BIGINT, DOUBLE, DECIMAL, and DATETIME values are implicitly converted to STRING before concatenation. Other data types cause an error.

Return value

  • Array overload: Returns an ARRAY value. Returns null if any input array is null.

  • String overload: Returns a STRING value. Returns null if no parameters are provided, or if any parameter is null.

Examples

Array concatenation

-- Returns: [10, 20, 20, -20]
select concat(array(10, 20), array(20, -20));
-- Null elements are included in the result. Returns: [10, null, 20, -20]
select concat(array(10, null), array(20, -20));
-- A null array causes the function to return null. Returns: null
select concat(array(10, 20), null);

String concatenation

-- Returns: aabcabcde
select concat('aabc', 'abcde');
-- No parameters. Returns: null
select concat();
-- A null string parameter causes the function to return null. Returns: null
select concat('aabc', 'abcde', null);

Related functions

CONCAT is available as both a complex type function and a string function.