Wednesday, 21 June 2023

Element Entries Query in Oracle HCM

SELECT  papf.person_number "PersonNumber"
        ,to_char(pee.effective_start_date,'YYYY/MM/DD') "ElementEntryEffectiveStartDate"
        ,to_char(pee.effective_end_date,'YYYY/MM/DD') "ElementEntryEffectiveEndtDate"
        ,petl.element_name "ElementName"
        ,pldgt.name "LegislativeDataGroupName"
        ,pldg.legislation_code "LegislationCode"
        ,piv.base_name "InputValueName"
        ,peev.screen_entry_value "ScreenEntryValue"
        ,to_char(peev.EFFECTIVE_START_DATE,'YYYY/MM/DD') "EntryValueStartDate"
        ,to_char(peev.EFFECTIVE_END_DATE,'YYYY/MM/DD') "EntryValueEndDate"
   FROM pay_element_entries_f pee,
        pay_element_types_f pet,
        pay_element_types_tl petl,
        pay_entry_usages peu,
        pay_payroll_assignments ppa,
        per_all_assignments_f paaf,
        per_periods_of_service ppos,
        per_all_people_f papf,
        per_legislative_data_groups pldg,
        per_legislative_data_groups_tl pldgt,
        pay_element_entry_values_f peev,
        pay_input_values_f piv
  WHERE ppos.date_start=(SELECT MAX(ppos1.date_start)
                           FROM per_periods_of_service  ppos1
                          WHERE ppos1.person_id=ppos.person_id
                            )
    AND ppos.period_of_service_id = paaf.period_of_service_id
    AND paaf.person_id = papf.person_id       
    AND paaf.assignment_type IN ('E')
    AND paaf.primary_flag = 'Y'   
    AND pee.element_type_id = pet.element_type_id
    AND pet.element_type_id = petl.element_type_id
    AND pee.element_entry_id = peu.element_entry_id
    AND peu.payroll_relationship_id=ppa.payroll_relationship_id
    AND ppa.hr_assignment_id = paaf.assignment_id
    AND paaf.legislation_code = pldg.legislation_code
    AND pldg.legislative_data_group_id = pldgt.legislative_data_group_id
    AND pee.element_entry_id = peev.element_entry_id
    AND peev.input_value_id = piv.input_value_id
    AND pet.element_type_id = piv.element_type_id
    AND pldgt.language = 'US'
    AND trunc(sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
    AND trunc(sysdate) BETWEEN papf.effective_start_date AND papf.effective_end_date
AND trunc(sysdate) BETWEEN peev.effective_start_date AND peev.effective_end_date
AND trunc(sysdate) BETWEEN pee.effective_start_date AND pee.effective_end_date
    AND petl.language = 'US'
    AND petl.element_name = 'ElementName'
and piv.base_name  = 'InputValue'
    AND papf.person_number in 
(
'12345'
)
order by papf.person_number

No comments:

Post a Comment