Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Filter on Hierarchical Query

Richard LeggeAug 22 2023

Hi All,

12.1

Hopefully a very simple question, but for some reason I cannot figure it out.

Given a simple treewalk, i.e.

select
lpad(' ',level*2,' ')||ename
ename,
empno,
mgr
from emp
START WITH MGR IS NULL
CONNECT BY PRIOR EMPNO = MGR

which produces the following:

How do I refine the query to just get (for example) Just Adams and his managers? (I clearly cannot put a where clause for Adams)

Many Thanks

Richard

This post has been answered by mathguy on Aug 22 2023
Jump to Answer
Comments
Post Details
Added on Aug 22 2023
13 comments
1,025 views