Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Root and leaf node from a hierarchical tree.

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
Message-ID: <4332b2fb$0$19240$626a14ce@news.free.fr>

"babu" <babu2244_at_hotmail.com> a écrit dans le message de news: 1127393704.063200.218020_at_g47g2000cwa.googlegroups.com...
|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 Received on Thu Sep 22 2005 - 08:35:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US