finding the ultimate parent
367852Mar 29 2006 — edited Mar 29 2006I 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 !