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: A hierarchical query - how do I do

Re: A hierarchical query - how do I do

From: oracle_doc <nilendu_at_nilendu.com>
Date: 18 Feb 2006 01:30:36 -0800
Message-ID: <1140255036.908350.289050@g44g2000cwa.googlegroups.com>


Thank You, Mladen. I remember reading you from 1999 :) You're as helpful as ever.

I am trying to do something a bit more complicated here than to just build a hierarchical tree. I think I should have supplied more data here. Sorry!!

Take a look at the TASK_PREDECESSORS table. The records could be -
PREDECESSOR_ID SUCCESSOR_ID

2       3
3       4
5      3
5       6

Tasks -

ID      NAME    PARENT_ID
1       A
2       a       1
3       b       1
5       c       1

I want a resultset that would *not only* build the tree within TASKS table -- but sort it
on PREDECESSOR - SUCCESSOR ID as well.

So, in the above example, I am looking for a resultset -

{A a c b}

I, of course, could do it in PL/SQL. The whole idea of putting this question was to get an idea if this is doable in SQL only. Maybe, using analytics? I don't know.

Again, thanks for pointing out to the manual. It's remained on my bookmark (and a favourite weekend read, believe me or not) for over 10 years now :)

Mladen Gogala wrote:
> On Fri, 17 Feb 2006 20:53:06 -0800, oracle_doc wrote:
Received on Sat Feb 18 2006 - 03:30:36 CST

Original text of this message

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