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 -> Need help with hierarchical query

Need help with hierarchical query

From: Phil Bewig <pbewig_at_swbell.net>
Date: 24 May 2004 11:28:32 -0700
Message-ID: <455f7154.0405241028.50b6ce2c@posting.google.com>


I need help writing a particular type of hierarchical query. Using the EMPLOYEES table from Oracle as a sample, I want a select statement that returns one row for each row in the employees table showing the entire hierarchy for that row:

    eid last_name lvl1 lvl2 lvl3 lvl4 lvl5

What I am trying to do seems similar to the SYS_CONNECT_BY_PATH string that Oracle provides, but I need to put the elements of the hierarchy into fields, not a string. I also note that queries using CONNNECT BY PRIOR return one row for each input row at each level of the hierarchy, which is not what I need.

This sounds simple, but I am stumped. Can anyone help?

Phil Received on Mon May 24 2004 - 13:28:32 CDT

Original text of this message

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