I'm trying to fetch a genealogy tree of animals from my Oracle database.
Here's the table:
Animal
------------------------
Animal_ID
Parent_Male_ID
Parent_Female_ID
....
....
------------------------
If I specify an animal, I can get all of its descendants (on the male side) using something like this:
SELECT *
FROM animal
START WITH animal_id = 123
CONNECT BY PRIOR animal_id = parent_male_id
I'm trying to find a way to extend this in such a way that if I specify an animal, it will fetch both parents and then will fetch all of their descendants.
Any thoughts? (this is Oracle 9.2)