correct, but as I have mention my inner query is giving me only parent but I want to make use of the result of the inner query again as input till I did not find any child ,so I am using procedure as I have to collect all the parent I get from the inner query and then update the outer query using the inner query result.it is the requirement what I want to achive, e.g update table A set A.a as "xyz" //here I will get t where A.id in ( select A.child_id from A,B,C --I get the child by passing parent as input and again consider the child as parent and find the child where A.id= b.id b.name = x and A.prent_id = ? //few join condtion here ) e.g input 1 result 1.1 input 1.1 result 1.1.1 input 1.1.1 result 1.1.1.1 update A where A.id in ('1.1','1.1.1','1.1.1.1')--here I want to use a container and make use of it Hope you get my intention now ..Thanks for your response.