Link Search Menu Expand Document


Returns a slice of the array based on the indicated offset and length.


SLICE(<arr>, <offset>[, <length>])
Parameter Description
<arr> The array of data to be sliced. Array elements set to NULL are handled as normal values. The numbering of the array items begins with 1.
<offset> Indicates starting point of the array slice. A positive value indicates an offset on the left, and a negative value is an indent on the right.
<length> The length of the required slice.
If you omit this value, the function returns the slice from the <offset> to the end of the array.


	SLICE([ 1, 2, NULL, 4, 5 ], 2, 3) AS res;

Returns: [2, null, 4]