Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Root and leaf node from a hierarchical tree.
I am working on oracle 9i. I have a table that has several tree strucutres stored in it. Tree strucutres can have any arbitrary depth. Root node has parent_id as null.
For Example :
Parent_Id Node_Id
rootA rootA A-child1 A-child1 A-leaf rootB rootB B-child1 rootB B-child12
In a single sql statement, I want to get the root node and the leaf node from this tree, I do not want other nodes in between.
So the result I need is
I am using connect by and start with in the select statement, but I am
not able to figure out, how to extract such a result with just one sql
statement.As the data is on production and I can not write any function
or programme
there. I need to have this data only using sql query. I can not use
connect-by-root as I am on 9i.
Please let me know whether it is possible or not.
Thanks, Received on Thu Sep 22 2005 - 08:12:34 CDT