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

Home -> Community -> Usenet -> c.d.o.misc -> hierachical query.

hierachical query.

From: <rudy.van_eeckhout_at_alcatel.be>
Date: Thu, 20 Sep 2001 08:41:01 +0200
Message-ID: <9oc33s$l94$1@bt02e2.god.bel.alcatel.be>

Hello,

  I do have a table which has an hierarchical structure. Example:

  Child     Parent    ParentType  ChildType
  1           null          1                  2
  2          1              2                  3
  3          2              3                  4
  4          3              4                  5
  5          1              2                  3
  6          5              3                  4
  7          6              4                  5
  8          1              2                  3
  9          8              3                  5
10          8              3                  5
...

Now i need a querry which give me records that list all the childs of childtype 5 whit they ancestor of type 3.

EG
ChildTp5 ParentTp3

    4               2
    7               5
    9               8
   10              8

I need to have this refference regardless the number of levels between the ancestor and the specified child.
 The maximum dept i can obtain of the moment is a difference of 2 levels. I could do this with next querry.

  select child, parent, prior parent
    from ...
     start with ...
    connect by prior ......

But when there are more level i can't find out how to get the information that i need. I did search in the documentation how to list the root node in an hierarchical querry.

    Kind regards

      Rudy Van Eeckhout Received on Thu Sep 20 2001 - 01:41:01 CDT

Original text of this message

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