Oracle10g connect_by_isleaf
connect_by_isleaf Example
The following example shows the first three levels of the scott.emp table, indicating for each row whether it is a leaf row ( which is indicated by 1 in the Leaf column) or whether it has child rows (which is indicated by 0 in the Leaf column):
SELECT ename "Employee", CONNECT_BY_ISLEAF "Leaf", LEVEL,
SYS_CONNECT_BY_PATH(ename,'/') "Path" FROM scott.emp
WHERE level <= 3 AND deptno = 10 START WITH ename ='KING'
CONNECT BY nocycle PRIOR empno = mgr AND LEVEL <= 4
;
No comments:
Post a Comment