An array constructor function constructs an array object. OceanBase Database supports the array() array constructor function and the [] operator.
array()
The array() function constructs an array object. The syntax is as follows:
array(elem1, elem2, elem3, ..., elemN)
[elem1, elem2, elem3, ..., elemN]
elem1 to elmenN: The input arguments must be of the same data type. For more information about supported array data types, see Overview.
Here is an example:
SELECT array(1, 2, 3);
+----------------+
| array(1, 2, 3) |
+----------------+
| [1,2,3] |
+----------------+
1 row in set
[]
You can also use the [] operator to construct an array object. Here is an example:
SELECT [1, 2, 3];
+-----------+
| [1, 2, 3] |
+-----------+
| [1,2,3] |
+-----------+
1 row in set