Oracle Error ORA-32621: illegal aggregation in UNTIL iteration condition

Oracle Error Message

ORA-32621: illegal aggregation in UNTIL iteration condition

Reason for the Error

An aggregate function was used in UNTIL condition.

Solution

Check the SQL statement and rewrite if necessary.