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 by reverse

990971Feb 13 2013 — edited Feb 13 2013
I have a tree like this
------[1]------
| | |
[2] [3] [4]
| | |
[6] [7] [9]
|
[8]

So I made a select:
SELECT id, id_parent
FROM TB_FLUXO_ELEMENTO
START WITH id = 7
CONNECT BY PRIOR id_parent = id;

I'm expecting this selected rows:
ID ID_PARENT
----------------- ---------------------
7 3
3 1
1 -1

BUT! Its returns lots of duplicated rows and childs 2 and 4.

Any ideas to get only the path I choose (start with = X) and run through the tree by reverse?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 13 2013
Added on Feb 13 2013
2 comments
478 views