select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
"ENAME" as title,
null as icon,
"EMPNO" as value,
"JOB" as tooltip,
'f?p=&APP_ID.:7:'||:APP_SESSION||'::::P7_EMPNO,P21_SELECTED_NODE:'||"EMPNO"||','||"EMPNO" as link
from "#OWNER#"."WWV_DEMO_EMP"
start with "MGR" is null
connect by prior "EMPNO" = "MGR"
order siblings by "ENAME"