Categories:

Semi-structured Data Functions (Array/Object)

ARRAY_CAT

Returns a concatenation of two arrays.

Syntax

ARRAY_CAT( <array1> , <array2> )

Arguments

array1

The source array.

array2

The array to be appended to array1.

Usage Notes

  • This function appends array2 to array1.

  • Both arguments must be of ARRAY type or VARIANT containing an array.

Examples

This example shows how to use ARRAY_CAT():

Create a simple table and data:

CREATE TABLE array_demo (ID INTEGER, array1 ARRAY, array2 ARRAY);
INSERT INTO array_demo (ID, array1, array2) 
    SELECT 1, ARRAY_CONSTRUCT(1, 2), ARRAY_CONSTRUCT(3, 4);

Execute the query:

SELECT ARRAY_CAT(array1, array2) FROM array_demo;
+---------------------------+
| ARRAY_CAT(ARRAY1, ARRAY2) |
|---------------------------|
| [                         |
|   1,                      |
|   2,                      |
|   3,                      |
|   4                       |
| ]                         |
+---------------------------+