Click here to Skip to main content
16,019,768 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
how is canonical tree constructed a given SQL query? How to optimize this tree?
Posted
Updated 18-Jan-10 8:18am
v2

1 solution

Hi Oracle provides Pseudo column Connect by Prior...

example:1
select name, slave_id, supervisor_id
from corporate_slaves
connect by prior slave_id = supervisor_id;

example:2
select /*+ first_rows */
rpad( '*', (level-1)*2, '*' ) ||
ename ename, empno, mgr_key
from emp
start with mgr_lookup(mgr_key) = -1
connect by prior empno = mgr_lookup(mgr_key);

hope it helps you...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900