ORA-49010
Group function is not allowed inside a quantified path pattern.
Cause
One of the group functions, such as AVG, COUNT, MAX, MIN, or SUM, was used in an element patten WHERE clause or a parenthesized path pattern WHERE clause inside a quantified path pattern.
Action
Specify the group function outside of the quantified path pattern.