Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Connect by dumps
I have a hierarchical relationship that I want to dump the entire
family given a parent. I have a table that tracks parents and
children relationships, I want to create a view that dumps the entire
family given a parent.
Scenario:
p1 has child p2, p2 has child p3.
Given p1, result set from view should be p2 and p3, given p2 result
set from view should be p3 etc...
Here is my pl/sql that creates the view:
create view treepath
as
SELECT parent, child
FROM td_view_dependants
START WITH parent in (select parent from td_view_dependants)
CONNECT BY child = prior parent
However the results from this are p1 has p2 and p2, p2 has p3.
Can anyone help with where I am going wrong? I am new to the connect
by clause.
Thanks
Ray
Received on Wed Nov 12 2003 - 22:40:01 CST