concat
The concat function is used to concatenate arrays or strings.
Syntax
Input is an array: Concatenates all elements from multiple arrays together to generate a new array.
concat(array , array [,...])
Input is a string: Concatenates multiple strings together to generate a new string.
concat(string , string [,...])
Parameters
Input is an array
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| a, b | Yes | ARRAY | Arrays. T in array<T> refers to the data type of the elements in the array. Elements in the array can be of any type. The data types of elements in a and b must be consistent. NULL values in the array participate in the operation. |
Input is a string
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| str1, str2 | Yes | STRING | Strings. If the input parameter is of type BIGINT, DOUBLE, DECIMAL, or DATETIME, it is automatically converted to STRING type before evaluation. Other types will return an error. |
Return Values
Returns a value of type ARRAY or STRING.
- Returns ARRAY type. If any input array is NULL, the return result is NULL.
- Returns STRING type. If there are no parameters or any parameter is NULL, the return result is NULL.
Example Code
- Concatenate arrays array(1, 2) and array(2, -2). The command example is as follows.
Returns [1,2,2,-2].
select concat(array(1, 2), array(2, -2));
- Concatenate strings ABC and DEF. The command example is as follows.
Returns ABCDEF.
select concat('ABC','DEF');
- The input is empty. The command example is as follows.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot