Re: Root and leaf node from a hierarchical tree.
- From: "Michel Cadot" <micadot{at}altern{dot}org>
- Date: Thu, 22 Sep 2005 15:35:04 +0200
"babu" <babu2244@xxxxxxxxxxx> a écrit dans le message de news: 1127393704.063200.218020@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|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
| B-child1 B1-leaf
| B-child12 B12-leaf
|
| 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
| -----------------------------
| rootA A-leaf
| rootB B1-leaf
| rootB B12-leaf.
|
| I am using connect by and start with clauses but I am not able to
| achieve the result by just writing a 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,
|
Have a look at section "Hierarchical Queries" in "SQL Reference":
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/queries4a.htm
Regards
Michel Cadot
.
- Follow-Ups:
- References:
- Root and leaf node from a hierarchical tree.
- From: babu
- Root and leaf node from a hierarchical tree.
- Prev by Date: Re: ora: 1033 : Oracle intialization or shutdown in progress
- Next by Date: Scheduling Stored Procedures
- Previous by thread: Root and leaf node from a hierarchical tree.
- Next by thread: Re: Root and leaf node from a hierarchical tree.
- Index(es):
Relevant Pages
|