SELECT CBD.ID,
                                                        level levels,
                                                         (CASE WHEN LEAD(level) OVER(ORDER BY rowNum) > level THEN '1' ELSE '0' END) isLeaf
                                                  FROM PRODUCT_TYPE CBD
                                                       where CBD.company_id  is null or CBD.company_id='C4FCAEEF63ED9F03E040860A50826BB5'
                                                       START WITH CBD.ID ='C4FE7B67ED2877A3E040860A5082732F'
                                                       CONNECT BY PRIOR CBD.ID = CBD.PRODUCT_PARENT_TYPE 
                                                   )typeTree
                                                   WHERE  1=1 and typeTree.levels =(
                                                   case when typeTree.isLeaf='0' and typeTree.levels='1'
                                                   then  '1' else   '2'  end
                                                   )
                                                   
同一个表中存在多层父子关系例如 a->b->c->d
查询B节点时 需要把 C 和D同事查出来  
求指教