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: Very perplexing select Problem

Re: Very perplexing select Problem

From: Kris <ComPlusss_at_gmail.com>
Date: 16 Sep 2005 15:26:51 -0700
Message-ID: <1126909610.958929.27230@g44g2000cwa.googlegroups.com>


try the following SQL

select level,decode(level,1,'PARENT','CHILD'), rec_id, parent_id from TABLE_REC start with parent_id = 0
connect by prior rec_id = parent_id

This will give hierarchical ordering of parent/children/grandchildren etc etc (level will tell you what hierarchical level they are at) ..

Hope it helps

Regards,
Gopal Krishan Received on Fri Sep 16 2005 - 17:26:51 CDT

Original text of this message

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