procedure update_traxxeo_person_act is cursor act_sync_cursor is select MfcService.MFC_SERVICE_ID, MfcService.ERP_ID, MfcService.NAME, MfcService.CODE, MfcService.STR_ID MFC_SERVICE_STR_ID, Activity.ACTIVITY_ID, Activity.ACTIVITY_CODE, Activity.ACTIVITY_NAME, Activity.STR_ID ACTIVITY_STR_ID from mfc_service MfcService, activity Activity where MfcService.ERP_ID = Activity.ACTIVITY_ID and Activity.LM_DATE > MfcService.LM_DATE; begin for act in act_sync_cursor loop if (act.MFC_SERVICE_STR_ID is null or NOT EXISTS(SELECT STR_ID FROM mf_owner.STR WHERE STR_ID = act.MFC_SERVICE_STR_ID)) then insert into mf_owner.str (str_id,str_value,mf_language_id) select str_id,str_value,1 from of_owner.str where str_id = act.ACTIVITY_STR_ID and language = 'EN'; insert into mf_owner.str (str_id,str_value,mf_language_id) select str_id,str_value,2 from of_owner.str where str_id = act.ACTIVITY_STR_ID and language = 'FR'; insert into mf_owner.str (str_id,str_value,mf_language_id) select str_id,str_value,3 from of_owner.str where str_id = act.ACTIVITY_STR_ID and language = 'DU'; else update mf_owner.str set str_id = act.ACTIVITY_STR_ID where str_id = act.MFC_SERVICE_STR_ID; update mf_owner.str set str_value = (select str_value from of_owner.str where str_id = act.ACTIVITY_STR_ID and language = 'EN') where str_id = act.ACTIVITY_STR_ID and mf_language_id = 1; update mf_owner.str set str_value = (select str_value from of_owner.str where str_id = act.ACTIVITY_STR_ID and language = 'FR') where str_id = act.ACTIVITY_STR_ID and mf_language_id = 2; update mf_owner.str set str_value = (select str_value from of_owner.str where str_id = act.ACTIVITY_STR_ID and language = 'DU') where str_id = act.ACTIVITY_STR_ID and mf_language_id = 3; end if; update MFC_SERVICE set CODE = act.ACTIVITY_CODE, NAME = act.ACTIVITY_NAME, STR_ID = act.ACTIVITY_STR_ID where MFC_SERVICE_ID = act.MFC_SERVICE_ID; end loop; end;