An aggregate function was incorrectly used inside an SPL routine expression, as an argument to an iterator table function, or inside a check constraint. These types of expressions cannot process aggregate functions.
The following examples show the incorrect use of an aggregate function:
LET var = MAX(another_var) + 10; -- error
SELECT 1 FROM TABLE(FUNCTION(udr1(max(1)))); -- error
An SPL routine expression, or the expression in a check constraint, can refer to only a single value, so the use of an aggregate function is meaningless.