ARRAY_REPEAT
functionsupportedCore SQL functionsReturns an ARRAY value containing a specified number of copies of an element.
Syntax
ARRAY_REPEAT( <element> , <count> )
Parameters
| Name | Required | Description |
|---|---|---|
element | required | The value to repeat in the output array. The value can be of any semi-structured data type — for example, VARIANT, ARRAY, OBJECT — or any standard Snowflake data type — for example, NUMBER, VARCHAR, BOOLEAN, DATE. Structured types, such as MAP, aren’t supported. |
count | required | An INTEGER expression specifying the number of times to repeat element. |
Returns
The function returns a semi-structured ARRAY value containing count copies of element. If count is NULL, the function returns NULL.
Usage notes
- If count is 0 or a negative number, the function returns an empty ARRAY.
- If element is NULL, the function returns an ARRAY of count NULL values.
- The element value is implicitly converted to VARIANT in the resulting ARRAY.