Using multiple UNION ALL statements in WITH clause Using multiple UNION ALL statements in WITH clause oracle oracle

Using multiple UNION ALL statements in WITH clause


In the recursion you want to go on with x on a y match and with y on an x match. Use CASE WHEN to check which one matches.

, rokon (x, y) AS (  SELECT x, y FROM testver  UNION ALL  SELECT CASE WHEN gy1.szulonek = r1.x THEN r1.y ELSE r1.x END, gy1.gyereke  FROM rokon r1  JOIN gyerek gy1 ON gy1.szulonek IN (r1.x, r1.y))