View the manger of the manger

alaa ayoub 1 Reputation point
2021-12-13T09:54:05.603+00:00

I would like to know how to retrieve all the manager of the managers above of any employee until it reaches the CEO when I enter any empno using function ??
and I want calling inside the code

I used this code

create or replace function F_e (E empno in number ) return varchar2
is
v_mgr varchar2 (20)
begin
select e.ename manger
into V_mgr
From emp e, emp m
where
e.empno=F_empno and e.mgr=m.empno;
return (v_mgr) ;
exception
when no data found ther
return null;
end;

Calling :

declare
V_ mgr varchar2 (20) :
Begin
V_mgr: =f_e (&f_ empno) ;
Dbms_output. put.line (v_mgr) ;
End;

Service Manager
Service Manager
A family of System Center products for managing incidents and problems.
237 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.