您的位置:首页 > 数据库 > Oracle

oracle 递归 树查找

2015-08-30 15:45 567 查看
-- 查询(oracle自带递归)

SELECT DEPT_ID, DEPT_NAME,SUPER_DEPT_ID FROM system_dept

where

connect_by_isleaf=1 -- 只选叶子节点

START WITH DEPT_ID in(

select a.object_id from system_role_object a,(select role_id from system_role where role_name='组织单位') b

where a.role_id=b.role_id and a.object_type='d'

)

CONNECT BY prior DEPT_ID = SUPER_DEPT_ID

----- 上网搜
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: