IBM PureData System for Analytics, Version 7.1

The array_split() function

The array_split() function parses the input for elements separated by a delimiter to create an array.

Description

The array_split() function has the following syntax:
array = array_split(varchar input, varchar delimiter [, [int type]);
array = array_split(nvarchar input, nchar delimiter [, [int type]);

The input value specifies a character delimited list of elements.

The delimiter value specifies the delimiter used in the input.

The optional type value specifies the type of the array; the type defaults to varchar.

Returns

For example, the following query creates an array from the input string, where the comma character delimits each array value:
select array_split('1,2,3,4,5,6,7,8',',');
 array_split 
-------------
 ARR
(1 row)
To view the elements of the array, you can use a query such as the following:
select array_combine(array_split('1,2,3,4,5,6,7,8',','),'|');
This example returns:
 array_combine  
-----------------
 1|2|3|4|5|6|7|8
(1 row)


Feedback | Copyright IBM Corporation 2014 | Last updated: 2014-02-28