SELECT papf1.full_name supervisor_nameFrom apps.per_all_people_f papf,
apps.per_all_assignments_f paaf,
apps.per_all_people_f papf1
WHERE papf.person_id = paaf.person_idAND paaf.primary_flag = ‘Y’AND
paaf.assignment_type = 'E'AND
paaf.supervisor_id = papf1.person_idAND
papf1.current_employee_flag = 'Y'AND
papf.business_group_id = paaf.business_group_idAND
SYSDATE BETWEEN papf.effective_start_date and
papf.effective_end_dateAND
SYSDATE BETWEEN paaf.effective_start_date AND
paaf.effective_end_dateAND
SYSDATE BETWEEN papf1.effective_start_date AND
papf1.effective_end_dateAND
papf.employee_number = :p_emp_number;