Oracle Error ORA-32041: UNION ALL operation in recursive WITH clause must have only two branches

Oracle Error Message

ORA-32041: UNION ALL operation in recursive WITH clause must have only two branches

Reason for the Error

A WITH clause query referred to itself (recursive) but used a UNION ALL operation with more than two branches, which is not currently supported.

Solution

Rewrite the recursive WITH clause query to use only two branches in the UNION ALL operation.