Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

CONNECT BY PRIOR

693241Jan 3 2011 — edited May 25 2011
Hello All ,

My oracle version is oracle 9i.

I have a table check with data as below ,

id parent id level
*1 2 1*
*2 3 2*
*3 4 3*
*1 5 1*
*5 6 2*
*6 7 3*
*7 8 4*

I want table output which traces through each end of node before it starts a new leaf like the output below ,

OUTPUT :
id level
1 1
2 2
3 3
5 2
6 3
7 4
8 5

How do i achieve this . Some how if i use connect by prior i have to use it like,

select proc_name from check
connect by prior
parent_id = id
and
connect by prior
lvl = (lvl-1);

which is not supported in oracle ,
so Is there anyother way in which i achieve the above output.

Thanks
vijay G
This post has been answered by kordirko on Jan 4 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 2 2011
Added on Jan 3 2011
9 comments
2,383 views