What is the best way to fetch Tree/Hierarchical structure data from Oracle?

SELECT id FROM q START WITH id IN ('Work1', 'Work2') CONNECT BY parent = PRIOR id AND id NOT IN ('Work1', 'Work2') This condition: AND id NOT IN ('Work1', 'Work2') will cut off the branches already selected with START WITH.

Thanks Quassnoi the soultion is working absolutely... – sqlnewbie Apr 12 at 16:16 I have a doubt here....in my case – sqlnewbie Apr 12 at 16:17 the query you suggested will assure me that it will start with values in the START WITH IN Clause and gets entire tree (top and bottom) for 'Work1' (firt value in IN clause), and then when it tries to fetch for 'Work2' (seconf value in IN clause) it see if it is alreary there 'Work1' tree it will skip that value and proceeds with next...PLEASE comment on my assumptions – sqlnewbie Apr 12 at 16:18 @Srinivas: it will start to fetch the tree starting from 1 and will stop on 2. Then it will fetch entire tree starting from 2. Just add CONNECT_BY_ROOT(id) into the query, it will become more clear.

– Quassnoi Apr 12 at 16:30 @Quassnoi- I tried in my db it is working fine :) Thanks a LOT! – sqlnewbie Apr 12 at 16:37.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions