日期:2014-05-17 浏览次数:20827 次
with t as
( select 'A' parent,'B' child from dual UNION
select 'A' parent,'D' child from dual UNION
select 'A' parent,'F' child from dual UNION
select 'B' parent,'T' child from dual UNION
select 'B' parent,'S' child from dual UNION
select 'D' parent,'H' child from dual UNION
select 'F' parent,'M' child from dual UNION
select 'N' parent,'B' child from dual UNION
select 'N' parent,'L' child from dual UNION
select 'N' parent,'Z' child from dual UNION
select 'L' parent,'D' child from dual UNION
select 'L' parent,'C' child from dual UNION
select 'Z' parent,'D' child from dual UNION
select 'Z' parent,'F' child from dual
)
select distinct parent from t
start with child='D'
connect by child = prior parent;