Query to fetch Position details of employee

 Query to fetch Position details of employee


select papf.person_number,
       papf.person_id,
       papf.start_date,
       ppnf.full_name employee_full_name,
       paam.assignment_number,
       hap.name       position_name,
       hap.hiring_status,
       hap.position_type,
       hap.permanent_temporary_flag,
       hap.full_part_time,
       hap.fte
from   per_all_people_f papf,
       per_all_assignments_m paam,
       per_person_names_f ppnf,
       hr_all_positions hap
where  1 = 1
       and trunc(sysdate) between papf.effective_start_date and
                                  papf.effective_end_date
       and papf.person_id = ppnf.person_id
       and trunc(sysdate) between ppnf.effective_start_date and
                                  ppnf.effective_end_date
       and ppnf.name_type = 'GLOBAL'
       and papf.person_id = paam.person_id
       and trunc(sysdate) between paam.effective_start_date and
                                  paam.effective_end_date
       and paam.assignment_status_type in ( 'ACTIVE' ) -- Active Assignment
       and paam.assignment_type in ( 'E' ) -- Type Employee
       and paam.primary_flag = 'Y' -- primary assignment
       and paam.position_id = hap.position_id(+)
       and trunc(sysdate) between hap.effective_start_date and
                                  hap.effective_end_date
       and hap.active_status = 'A'
--and papf.person_number = :p_person_number -- parameter

No comments:

Post a Comment