Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Very perplexing select Problem
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