with a as
(
select 'A' lotid, 'B' node from dual
union all
select 'B' lotid, 'C' node from dual
union all
select 'D' lotid, 'E' node from dual
union all
select 'F' lotid, 'G' node from dual
union all
select 'F' lotid, 'H' node from dual
)
select *
from a
start with lotid ='A'
connect by nocycle prior node = lotid
* 기초데이터
PARENT | CHILD |
A | B |
B | C |
D | E |
F | G |
F | H |
A검색 결과 | |
lotid | node |
A | B |
B | C |
C | - |
D 검색 결과 | |
lotid | node |
D | E |
E | - |
F 검색결과 | |
lotid | node |
F | G |
G | - |
F | H |
H | - |