Complete Supervisor Hierarchy for an employee SQL Oracle -


how can print entire employee hierarchy each employee using oracle sql hierarchial query.

sample employee table>>

empid, ename, mgr 1,     a,     1 2,     b,     1 3,     c,     2 4,     c,     2 5,     c,     3 

sample output>>

empid, ename, hierarchy 1,     a,     - 2,     b,     /1 3,     c,     /1/2 4,     c,     /1/2 5,     c,     /1/2/3 

can me. in advance.

don't have database test out on, thinking need use sys_connect_by_path , connect prior. try like:

select empid, ename, sys_connect_by_path(mgr, '/') "heirarchy" employee connect prior empid= mgr; 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -