Skip to main content

Categories: Conversion, Semi-Structured Data

ARRAY_TO_STRING

Returns a string of the values from the input array, with the values separated by the specified delimiter string. Values are cast to strings before they are joined. The function does not accept NULL input.

Syntax​

ARRAY_TO_STRING(arr LIST, delimiter VARCHAR) → VARCHAR​

  • arr: The source array.
  • delimiter: The string to place between each element in the array.

Examples

ARRAY_TO_STRING example
SELECT ARRAY_TO_STRING(ARRAY[1, 2, 3], ',')
-- 1,2,3
array_col contains ARRAY[1, NULL, 3]
SELECT ARRAY_TO_STRING(array_col, ',')
-- 1,,3