oracle hierarchical query(分级查询)

xiaoxiao2024-07-24  34

hierarchical_query_clause

Hierarchical Query Operators :PRIOR、CONNECT_BY_ROOT.Hierarchical Query Pseudocolumns :CONNECT_BY_ISCYCLE、CONNECT_BY_ISLEAF、LEVEL. 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

 

 

转载请注明原文地址: https://www.6miu.com/read-5017101.html

最新回复(0)