View the manger of the manger
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;