[Home] [Help]
595: -- This cursor gets the latest date on which the given Extra information Type record
596: -- is inserted or updated on or before the given date
597: -- and then gets the the record with highest history id on that date.
598:
599: -- In c_history_id join on PER_POSITION_EXTRA_INFO is required to skip the history records
600: -- on the extra information records that are deleted.
601: cursor c_history_id is
602: select nvl(max(gph1.pa_history_id),hr_api.g_number) pa_history_id
603: from ghr_pa_history gph1,
600: -- on the extra information records that are deleted.
601: cursor c_history_id is
602: select nvl(max(gph1.pa_history_id),hr_api.g_number) pa_history_id
603: from ghr_pa_history gph1,
604: PER_POSITION_EXTRA_INFO pei1
605: where gph1.table_name = 'PER_POSITION_EXTRA_INFO'
606: and pei1.position_id = p_position_id
607: and pei1.information_type = p_information_type
608: and gph1.information1 = to_char(pei1.position_extra_info_id)
601: cursor c_history_id is
602: select nvl(max(gph1.pa_history_id),hr_api.g_number) pa_history_id
603: from ghr_pa_history gph1,
604: PER_POSITION_EXTRA_INFO pei1
605: where gph1.table_name = 'PER_POSITION_EXTRA_INFO'
606: and pei1.position_id = p_position_id
607: and pei1.information_type = p_information_type
608: and gph1.information1 = to_char(pei1.position_extra_info_id)
609: and gph1.effective_date = ( select max(gph2.effective_date)maxdate
607: and pei1.information_type = p_information_type
608: and gph1.information1 = to_char(pei1.position_extra_info_id)
609: and gph1.effective_date = ( select max(gph2.effective_date)maxdate
610: from ghr_pa_history gph2
611: where gph2.table_name = 'PER_POSITION_EXTRA_INFO'
612: and gph2.effective_date <= p_effective_date
613: and gph2.information1 = to_char(pei1.position_extra_info_id)) ;
614:
615: Begin