---- 向上遞迴select
distinct orgguid,dtb_orgguid,orgname
from
dtba_organization a
start with orgguid
= '2117bc0897e543168fd9702216165c77
'connect by prior dtb_orgguid
=orgguid
orgguid 最小級別
---- 向下遞迴
select
distinct orgguid,dtb_orgguid,orgname
from
dtba_organization a
start with dtb_orgguid
= '5ca832cb82ed487d9b946890692529fe
'connect by prior orgguid
= dtb_orgguid
dtb_orgguid 最大級別
--查詢全部資源資訊select * from
urm_class_info
--向上遍歷樹,找到路徑直到根節點,指定的是parentid
select
distinct classid,parentid,name
from
urm_class_info
start with parentid = '
cmdb0000000000000017
'connect by prior parentid =classid
--向上遍歷樹,找到路徑直到根節點,指定的是classid,和下面的主要區別就是parentid和classid的位置
select
classid,parentid,name
from
urm_class_info
start with classid = '
cmdb0000000000000401
'connect by prior parentid =classid
--向下遍歷整棵樹,可以指定classid,來遍歷指定節點的樹
select
classid,parentid,name
from
urm_class_info
start with classid = '
cmdb0000000000000017
'connect by prior classid =parentid
--向下遍歷整棵樹,可以指定parentid,來遍歷指定parentid節點的樹,不包含parentid
select
classid,parentid,name
from
urm_class_info
start with parentid = '
cmdb0000000000000017
'connect by prior classid = parentid
Oracle 向上遞迴 向下遞迴
向上遞迴 select distinct orgguid,dtb orgguid,orgname from dtba organization a start with orgguid 2117bc0897e543168fd9702216165c77 connect by prior dtb org...
oracle 遞迴查詢,向上和向下遍歷
查詢全部資源資訊 select from urm class info 向上遍歷樹,找到路徑直到根節點,指定的是parentid select distinct classid,parentid,name from urm class info start with parentid cmdb000...
oracle 遞迴查詢,向上和向下遍歷
以查詢系統功能在選單那個目錄下為例 系統選單表 sys menus,系統功能表 sys func 查詢全部資源資訊 select from sys menus 向上遍歷樹,找到路徑直到根節點,指定的是f parent 向上遍歷樹,找到路徑直到根節點,指定的是f menu id,和下面的主要區別就是f...