Returns the sum of elements of <array>.

Syntax

ARRAY_SUM(<array>)

Parameters

ParameterDescriptionSupported input types
<array>The array to be used to calculate the function.Any array of numeric types

Return Type

The return type depends on the input type:

Array element typeReturn type
INTEGERBIGINT
BIGINTNUMERIC(38, 0)
NUMERIC(precision, scale)NUMERIC(precision, scale)
REALREAL
DOUBLEDOUBLE

Example

SELECT
	ARRAY_SUM([ 4, 1, 3, 2 ]) AS levels;

Returns: 10