ARRAY_CAT

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Concatenates two arrays into a single array.

Syntax 

1ARRAY_CAT(<array1>, <array2>)

Arguments 

Required 

  • <array1>: The first array.
  • <array2>: The second array to concatenate to the first.

Returns 

Returns an array that contains all elements from both input arrays in order.

Considerations 

  • The resulting element type is non-nullable only if both input element types are non-nullable.
  • Both arrays must have compatible element types, otherwise your SQL query will fail.

Examples 

Concatenate Two Arrays 

Combine two arrays.

1SELECT ARRAY_CAT(array[1, 2], array[3, 4]) AS result;

Returns array[1, 2, 3, 4], combining both arrays.

Concatenate with NULL Elements 

Combine arrays where one contains NULL values.

1SELECT ARRAY_CAT(array[1, null], array[3, 4]) AS result;

Returns array[1, null, 3, 4]. The resulting element type is nullable when either input contains NULL.

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!