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 theNOCYCLE
parameter of theCONNECT
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