Re: Root and leaf node from a hierarchical tree.




"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


.



Relevant Pages

  • Root and leaf node from a hierarchical tree.
    ... Tree strucutres can have any arbitrary depth. ... Root node has parent_id as null. ... A-child1 A-leaf ... In a single sql statement, I want to get the root node and the leaf ...
    (comp.databases.oracle.server)
  • Re: I thought this should work :-(
    ... within the tree is a highly unusual, and highly suspect, design. ... There is substantial amount of functionality ... My tree is similar to the one mentioned for Windows Explorer. ... root node that has some of the functionality of subnodes but also has ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Binqry Tree sort
    ... In addition we have a network as a parallel ... But the processors which I want to use in my bianry tree architecture ... The root node has no bottle neck becasue it just receives data from its ...
    (comp.programming)
  • Re: to merge two binary tree
    ... node has to be taken as root node in the new tree ...etc ... Surely there must be an algorithm in Knuth. ... The root node of the merge will in general ... to a usual binary-tree insertion algorithm. ...
    (comp.lang.c.moderated)
  • RE: Newbie: Trouble accessing all nodes in a tree view
    ... My tree has a single root node named ... > a new node at a deep level on the tree. ... > listed in the collection is the root node Clients. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)