I have a table called "test". It contains Parent and Child columns.
Parent Child
1 101
1 102
1 103
101 121
101 123
103 133
121 80
121 81
Now, I wrote a query which brings me all the child/parents for the given "1" value.
( SELECT parent,child,LEVEL FROM TEST
START WITH child= 1
CONNECT BY PRIOR parent=child)
UNION ALL
(SELECT parent,child,LEVEL FROM TEST
START WITH parent=1
CONNECT BY PRIOR child=parent)
ORDER BY parent
But I want all the child/parent in that hierarchy irrespective of any value given ..i.e. if I give "80" ...., I have to fetch HIGHEST PARENT VALUE( in this case "1") and then search all the children of that highest parent value below.