Oracle Error ORA-32042: recursive WITH clause must reference itself directly in one of the UNION ALL branches

Oracle Error Message

ORA-32042: recursive WITH clause must reference itself directly in one of the UNION ALL branches

Reason for the Error

A WITH clause query referred to itself (recursive) indirectly, such as through a subquery or view.

Solution

Rewrite the recursive WITH clause query to refer to itself directly in the FROM clause of one of the UNION ALL branches.