-441   INVALID USE OF 'DISTINCT' OR 'ALL' WITH FUNCTION function-name

Explanation

This error can occur for the following situations:

  • The keyword DISTINCT or ALL was detected within parentheses in a reference to function function-name and the function has been resolved as a scalar function. Use of the keywords DISTINCT or ALL with the specified scalar function is invalid.
  • The keyword DISTINCT was detected within parentheses in a reference to function function-name and the function has been resolved as an aggregate function. Use of the keywords DISTINCT with the specified aggregate function is not valid.
  • The function was expected to be an aggregate function supporting the keyword ALL or DISTINCT, but the function that was resolved to is not an aggregate function.

System action

The statement cannot be processed.

Programmer response

Take the appropriate action:
  • If a scalar function is being used, then remove the keyword DISTINCT or ALL.
  • If the function is an aggregate function that does not support the DISTINCT or ALL keywords, then remove the keyword.
  • Otherwise, if an aggregate function is being used, then there is a problem with function resolution. Check your SQL path to see if the function is in one of the schemas, and also check the SYSIBM.SYSROUTINES catalog for the spelling of the function name and the number and types of parameters

SQLSTATE

42601