Slide 144
Slide 144 text
select f.id as id
,f.nome as funcionario
,f.cargo as cargo
,f.gerente_id as gerente_id
,level
,lpad('.', (level-1), '.') || f.nome as tree
,sys_connect_by_path(f.nome, '->') as path
,connect_by_iscycle as is_cycle
,connect_by_isleaf as is_leaf
,connect_by_root f.id as root_id
from tb_funcionarios f
connect by nocycle f.gerente_id = prior f.id
start with f.gerente_id is null
order siblings by f.nome
;