ARRAY_FLATTEN
functionsupportedCore SQL functionsFlattens an ARRAY of ARRAYs into a single ARRAY. The function effectively concatenates the ARRAYs that are elements of the input ARRAY and returns them as a single ARRAY.
Syntax
ARRAY_FLATTEN( <array> )
Parameters
| Name | Required | Description |
|---|---|---|
array | required | The ARRAY of ARRAYs to flatten. If any element of array is not an ARRAY, the function reports an error. |
Returns
This function returns an ARRAY that is constructed by concatenating the ARRAYs in array. If array is NULL or contains any elements that are NULL, the function returns NULL.
Usage notes
- If array contains multiple levels of nested ARRAYs, the function only removes one level of nesting. For example, if the input ARRAY is: [ [ [1, 2], [3] ], [ [4], [5] ] ] The function returns: Copy code [ [1, 2], [3], [4], [5] ]