Friday, July 8, 2016

Query for getting Employee Personal and Assignment Details.

SELECT
papf.person_id Person_Id,
papf.employee_number Employee_Number,
papf.full_name Full_Name,
DECODE(papf.sex,'M','Male','F','Female') Sex,
fcl1.meaning Marital_Status,
fcl2.meaning Nationality,
papf.date_of_birth Date_Of_Birth,
haou.name Organization,
pj.name Job_Name,
pg.name Grade_Name,
pp.name Position_Name,
hla.location_code Location_Name
   FROM  
per_all_people_f papf,
per_periods_of_service ppos,
fnd_common_lookups fcl1,
fnd_common_lookups fcl2,
per_all_assignments_f paaf,
hr_all_organization_units haou,
per_jobs pj,
per_grades pg,
per_positions pp,
hr_locations_all hla
   WHERE
papf.business_group_id = P_Business_Group_Id
AND papf.current_employee_flag = 'Y'
AND TRUNC(SYSDATE) BETWEEN papf.effective_start_date AND papf.effective_end_date
AND papf.person_id = ppos.person_id
AND papf.marital_status = fcl1.lookup_code
AND UPPER(fcl1.lookup_type) = UPPER('MAR_STATUS')
AND fcl1.enabled_flag = 'Y'
AND papf.nationality = fcl2.lookup_code
AND UPPER(fcl2.lookup_type) = UPPER('NATIONALITY')
AND fcl2.enabled_flag = 'Y'
AND papf.person_id = paaf.person_id
AND TRUNC(SYSDATE) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND paaf.primary_flag = 'Y'
AND paaf.organization_id = haou.organization_id
AND paaf.job_id = pj.job_id (+)
AND paaf.grade_id = pg.grade_id (+)
AND paaf.position_id = pp.position_id (+)
AND paaf.location_id = hla.location_id (+);

No comments:

Post a Comment

Search This Blog