Home » SQL & PL/SQL » SQL & PL/SQL » hierarchy
hierarchy [message #314021] Tue, 15 April 2008 10:00 Go to next message
hany_marawan
Messages: 198
Registered: April 2005
Location: Cairo - Egypt
Senior Member
Hello
I know that's oracle can build a hierarchy from above to bottom by "connect by prior" statement.
But can I build this hierarchy to give me the the data from bottom to above.
i.e if I have an employee with number 4 and has a manager with number 3 so
If I have the employee 4 how can I get his manager

Thanks
Re: hierarchy [message #314023 is a reply to message #314021] Tue, 15 April 2008 10:04 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
This is NOT an expert question.

It is clearly stated in the forum description: "Newbies should not post to this forum!"
Expert notion is defined in the sticky: Not an EXPERT? Post in the NEWBIES forum, NOT here
Rules are described in: OraFAQ Forum Guide
Read them, follow them including what is said about formatting.

As you are an expert, I don't answer the question because you obviously already knows it.

Regards
Michel
Re: hierarchy [message #314151 is a reply to message #314023] Tue, 15 April 2008 22:01 Go to previous message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Rather than
CONNECT BY PRIOR emp_num = manager
START WITH manager IS NULL

use
CONNECT BY emp_num = PRIOR manager
START WITH emp_num = 3


Ross Leishman
Previous Topic: Purging
Next Topic: Problem in passing date as parameter
Goto Forum:
  


Current Time: Thu Feb 06 16:04:49 CST 2025