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!

finding the ultimate parent

367852Mar 29 2006 — edited Mar 29 2006
I have a table structure with columns companyid, parentcompanyid. The ultimate parent in the hierarchy wull have the companyid and parentcompayid same.
i.e
compayid parentcompanyid
1 100
100 1000
1000 1000
The ultimate parent in the above case is 1000.

I am using oracle9i, I tried using connect by - prior code, it gave me a cyclic data encountered problem. Is there a way out other that writing a recursive function to get to the ultimate parent ?

Thanks In Advance !
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 26 2006
Added on Mar 29 2006
6 comments
486 views