Oracle Error QSM-02140: agg(expr) requires correspondng SUM(expr*expr) function

Oracle Error Message

QSM-02140: agg(expr) requires correspondng SUM(expr*expr) function

Reason for the Error

The capability in question is not supported when the materialized view uses certain aggregate functions but omits an invocation of the SUM function on the square of the same argument (the argument multiplied by itself).

Solution

Add the SUM function on the square of the argument.