DB2 Version 10.1 for Linux, UNIX, and Windows

FP2: ARRAY_AGG aggregate function enhancements

In DB2® Version 10.1 Fix Pack 2 and later fix packs, the ARRAY_AGG function is being extended to support the generation of associative arrays and arrays with a row element type.

An optional first argument is added to the function which, when specified, represents the associative array index expression. If this argument is omitted an ordinary array is generated.

An array of rows can be constructed in two ways. A row expression can be used to specify a scalar row value which becomes the elements of the array. Or, a list of two or more expressions can be input to the ARRAY_AGG function. This set of values represents the fields in the row data type that is the array element.