Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Validating a hierarchical query
I can write a hierarchical query against the
employees sample table like this:
select lpad(' ', (level-1)*2, ' ') || first_name || ' ' || last_name from employees
For purposes of writing a validation suite,
I would like to check that the hierarchy is
valid, forming a singly-rooted directed
acyclic graph. It is easy enough to test
that only one record has a null manager_id,
that no record has equal employee_id and
manager_id, and that each manager_id appears
in the employee_id field of some record in
the table. But testing that there are no
cycles, and no breaks in the hierarchical
chain, is harder. Can anyone suggest how to
make the needed tests?
Many thanks,
Phil Received on Thu Sep 30 2004 - 10:52:10 CDT
![]() |
![]() |