`
xshq
  • 浏览: 43301 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

oracle hierarchical query(分级查询)

阅读更多

hierarchical_query_clause


  1. Hierarchical Query Operators :PRIORCONNECT_BY_ROOT.
  2. Hierarchical Query Pseudocolumns :CONNECT_BY_ISCYCLE、CONNECT_BY_ISLEAF、LEVEL. 
  3. You can specify CONNECT_BY_ISCYCLE only if you have specified the NOCYCLE parameter of the CONNECT BY clause.
select t.dept_name "AreaName",
       connect_by_root t.dept_name "Root",
       connect_by_isleaf "isLeaf",
       connect_by_iscycle "isCycle",
       level,
       Sys_connect_by_path(t.dept_name, '/') "Path"
  from rs_dept t
/*where level = 4*/
 start with t.upper_dept_id = '1'
connect by nocycle prior t.dept_id = t.upper_dept_id

 

 

  • 大小: 2.8 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics