In this session we are going to see how to fetch the Oracle Cloud HCM TRU associated with Legal Employer using SQL
SQL Text:
select papf.person_number
,paam.assignment_number
,ppnf.full_name
,pdccd.display_name
,tru.name
from per_all_people_f papf
,per_person_names_f ppnf
,per_all_assignments_m paam
,pay_payroll_assignments ppa
,pay_dir_cards_f pdcf
,pay_dir_card_definitions_vl pdccd
,pay_dir_card_components_f pdccf
,pay_dir_rep_cards_f pdrcf
,hr_organization_v tru
where 1 = 1
-- and papf.person_number in ('0000')
and papf.person_id = ppnf.person_id
and papf.person_id = paam.person_id
and paam.legislation_code = 'US'
and ppa.hr_assignment_id = paam.assignment_id
and pdcf.payroll_relationship_id = ppa.payroll_relationship_id
and pdccd.dir_card_definition_id = pdcf.dir_card_definition_id
and pdccf.dir_card_id = pdcf.dir_card_id
and pdccd.display_name = 'Tax Withholding'
and pdrcf.dir_card_comp_id = pdccf.dir_card_comp_id
and pdrcf.dir_card_id = pdccf.dir_card_id
and paam.assignment_status_type = 'ACTIVE'
and paam.assignment_type = 'E'
and ppnf.name_type = 'GLOBAL'
and paam.effective_latest_change = 'Y'
and tru.organization_id = pdrcf.tax_unit_id
and tru.classification_code = 'HCM_TRU'
and tru.status = 'A'
and trunc(sysdate) between ppa.start_date and ppa.end_date
and trunc(sysdate) between paam.effective_start_date and paam.effective_end_date
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
and trunc(sysdate) between ppnf.effective_start_date and ppnf.effective_end_date
and trunc(sysdate) between pdcf.effective_start_date and coalesce(pdcf.effective_end_date,to_date('4712-12-31'))
and trunc(sysdate) between pdccf.effective_start_date and coalesce(pdccf.effective_end_date,to_date('4712-12-31'))
and trunc(sysdate) between pdrcf.effective_start_date and coalesce(pdrcf.effective_end_date,to_date('4712-12-31'))
and trunc(sysdate) between tru.effective_start_date and tru.effective_end_date
Comments
Post a Comment