Search This Blog

Saturday, September 28, 2019

Oracle Apps R12 Query for Employee contact relationship and details.

SELECT papf.person_id employee_id, papf.full_name employee_name,papf.employee_number,
papf.effective_start_date employee_start_date,
papf.effective_end_date employee_end_date,
papf_cont.full_name contact_name, hl.meaning contact_type,pcr.contact_type,
pcr.date_start contact_start_date, pcr.date_end contact_end_date, papf_cont.date_of_birth contact_dob, papf_cont.sex
FROM per_contact_relationships pcr,
per_all_people_f papf,
hr_lookups hl,
per_all_people_f papf_cont --contact info also saved in per_all_people_f without emp_num
WHERE 1 = 1
AND papf.person_id = pcr.person_id
AND pcr.contact_person_id = papf_cont.person_id
AND NVL (TRUNC (papf.effective_end_date), SYSDATE) >= TRUNC (SYSDATE)
AND NVL (TRUNC (papf_cont.effective_end_date), SYSDATE) >= TRUNC (SYSDATE)
AND hl.lookup_type(+) = 'CONTACT'
AND hl.lookup_code(+) = pcr.contact_type
and papf.employee_number = '1234'

No comments:

Post a Comment