SELECT source_id.source_system_owner,
source_id.source_system_id,eeval.element_entry_value_id,
To_char(eeval.effective_start_date, 'yyyy/mm/dd') effective_start_date,
To_char(eeval.effective_end_date, 'yyyy/mm/dd') effective_end_date,
eeval.element_entry_id,
Decode(inval.uom, 'D', To_char(To_date(eeval.screen_entry_value,
'YYYY-MM-DD HH24:MI:SS'),
'YYYY/MM/DD HH24:MI:SS'),
'N', CASE
WHEN eeval.screen_entry_value BETWEEN 0 AND 1
AND eeval.screen_entry_value NOT IN ( 0, 1
) THEN
'0'
||eeval.screen_entry_value
WHEN eeval.screen_entry_value >= 1 THEN
eeval.screen_entry_value
WHEN eeval.screen_entry_value <= 0 THEN
eeval.screen_entry_value
END,
'M', CASE
WHEN eeval.screen_entry_value BETWEEN 0 AND 1
AND eeval.screen_entry_value NOT IN ( 0, 1
) THEN
'0'
||eeval.screen_entry_value
WHEN eeval.screen_entry_value >= 1 THEN
eeval.screen_entry_value
WHEN eeval.screen_entry_value <= 0 THEN
eeval.screen_entry_value
END,
eeval.screen_entry_value) screen_entry_value,
eeval.created_by,
etype.element_name,
asgmt.assignment_number,
inval.base_name
FROM pay_element_entry_values_f eeval,
pay_element_entries_f eentry,
pay_entry_usages eent_usag,
pay_rel_groups_dn rel_group,
per_all_assignments_f asgmt,
pay_element_types_tl etype,
pay_element_types_f etypeF,
pay_input_values_f inval,
hrc_integration_key_map source_id
WHERE 1 = 1
-- AND SYSDATE BETWEEN eeval.effective_start_date AND eeval.effective_end_date
-- AND SYSDATE BETWEEN eentry.effective_start_date AND eentry.effective_end_date
-- AND SYSDATE BETWEEN nvl(eent_usag.date_from, SYSDATE - 1) AND nvl(eent_usag.date_to, SYSDATE + 1)
AND SYSDATE BETWEEN Nvl(rel_group.start_date, SYSDATE - 1) AND Nvl(
rel_group.end_date, SYSDATE + 1)
AND SYSDATE BETWEEN asgmt.effective_start_date(+) AND
asgmt.effective_end_date(+)
AND SYSDATE BETWEEN inval.effective_start_date AND
inval.effective_end_date
AND SYSDATE BETWEEN etypeF.effective_start_date AND
etypeF.effective_end_date
AND etype.LANGUAGE = Userenv('LANG')
AND eentry.element_entry_id = eeval.element_entry_id
AND eentry.element_entry_id = eent_usag.element_entry_id
AND eent_usag.payroll_assignment_id = rel_group.relationship_group_id
AND rel_group.assignment_id = asgmt.assignment_id(+)
AND etypeF.element_type_id = eentry.element_type_id
AND etype.element_type_id = eentry.element_type_id
AND inval.input_value_id = eeval.input_value_id
AND source_id.surrogate_id = eeval.element_entry_value_id
AND source_id.object_name = 'ElementEntryValue'
AND etypeF.processing_type = 'N'