SQL Script to display the Employee and Supervisor hierarchy details:-
Below Query to fetch the specific person's supervisor details upto higher position level wise
SELECTLEVEL seq ,
e.person_id ,
e.grade_id ,
e.job_id ,
e.supervisor_id ,
e.employee_number,
e.full_name
FROM
(
SELECT DISTINCT
paf.person_id ,
paf.grade_id ,
paf.job_id ,
paf.supervisor_id ,
ppf.employee_number,
ppf.full_name
FROM
per_all_people_f ppf
LEFT JOIN
per_all_assignments_f paf
ON ppf.person_id = paf.person_id
AND paf.person_id IS NOT NULL
AND (
SYSDATE BETWEEN ppf.effective_start_date AND ppf.effective_end_date )
AND (
SYSDATE BETWEEN paf.effective_start_date AND paf.effective_end_date )
) e
CONNECT BY person_id = PRIOR supervisor_id
START WITH person_id = :P_PERSON_ID ORDER BY LEVEL
No comments:
Post a Comment