oracle树形查询

来源:互联网 发布:c语言输出*等腰三角形 编辑:程序博客网 时间:2024/06/05 08:04
查询父节点下所有子节点
select *  from table connect by prior parent列名 = child列名start with parent_id=''

for example :
  select * from tbl_role_inf connect by prior reserve4 = role_id start with reserve4 = ''

以start with =parent为起点想下递归查询
操作符“prior”可以取得上一级的信息
connect by 子句列出递归的条件

树形查询排序使用专用关键字“SIBLINGS”不会影响树形结构 order siblings by 
树形查询中的where

select *  from table connect by prior parent = child and prior !=321 start with parent
0 0
原创粉丝点击