Oracle connect by prior

--向下递归

select t.id   from PROVINCE_CITY t
                   connect by prior t.id = t.parent_id
                    start with t.id = :provinceCityTree ;

 

--向上递归

select t.id   from PROVINCE_CITY t
                   connect by prior t.parent_id = t.id
                    start with t.id = :provinceCityTree

猜你喜欢

转载自liushengit.iteye.com/blog/2302741
今日推荐