This function is used to concatenate arrays or strings.
If multiple arrays are used as the input, all elements in the arrays are connected to generate a new array.
concat(array<T> <a>, array<T> <b>[,...])
If multiple strings are used as the input, the strings are connected to generate a new string.
concat(string <str1>, string <str2>[,...])
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
a, b |
Yes |
STRING |
Array In array<T>, T indicates the data type of the elements in the array. The elements in the array can be of any type. The data types of elements in arrays a and b must be the same. If the values of the elements in an array are NULL, the elements are involved in the operation. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
str1, str2 |
Yes |
STRING |
String If the value of the input parameter is of the BIGINT, DOUBLE, DECIMAL, or DATETIME type, the value is automatically converted to the STRING type for calculation. For other types of values, an error is reported. |
The return value is of the ARRAY or STRING type.
select concat(array(10, 20), null);
select concat('abc', 'def', null);