I hope I can explain the problem that puzzles me. I have the following set of hierarchical data (this is just a subset of 34K records)
PARENT_ID CHILD_ID EXAM TUDA12802 TUDA12982 N TUDA12982 TUDA12984 J TUDA12984 TUDA999 J TUDA12982 TUDA12983 N TUDA12983 TUDA15322 J TUDA12983 TUDA15323 J
This is a view of a tree.
TUDA12982 N - TUDA12984 J -- TUDA999 J - TUDA12983 N -- TUDA15322 J -- TUDA15323 J
I need a list of all records with exam = N and basic exam records "J", which can be nested.
select * from test1 connect by prior child_id = parent_id start with child_id = 'TUDA12982' order siblings by child_id;
Gives me
PARENT_ID CHILD_ID EXAM TUDA12802 TUDA12982 N TUDA12982 TUDA12984 J TUDA12984 TUDA999 J TUDA12982 TUDA12983 N TUDA12983 TUDA15323 J TUDA12983 TUDA15322 J
But i need
TUDA12802 TUDA12982 N TUDA12982 TUDA12984 J TUDA12984 TUDA999 J
Moving must be stopped when I encounter EXAM = 'N'.
I need something like a "stop with" clause.
select * from test1 connect by prior child_id = parent_id start with child_id = 'TUDA12982' stop with exam = 'N' order siblings by child_id;
How can I do that?
source share