DECLARE
v_api_error VARCHAR2 (5000);
v_error_msg VARCHAR2 (5000) := NULL;
p_person_id NUMBER;
----------------------------------
p_validate BOOLEAN;
p_effective_date DATE;
p_warn_ee VARCHAR2 (5000);
BEGIN
FOR hr_data IN (SELECT xx.*
FROM xx_hr_upload_master_data_ets xx
where xx.EMPLOYEE_NUMBER in ('1','2'))
-- WHERE NVL (xx.emp_data, 'T_Error') <> 'Done')
LOOP
BEGIN
p_validate := FALSE;
SELECT person_id, effective_start_date
INTO p_person_id, p_effective_date
FROM per_all_people_f
WHERE employee_number = hr_data.employee_number
AND effective_end_date > SYSDATE
AND business_group_id = hr_data.business_group_id;
hr_change_start_date_api.update_start_date
(p_validate => p_validate,
p_person_id => p_person_id,
p_old_start_date => p_effective_date,
p_new_start_date => hr_data.hire_date,
p_update_type => 'CORRECTION',
p_warn_ee => p_warn_ee
);
UPDATE xx_hr_upload_master_data_ets
SET emp_data = 'Done1',
error_msg = 'Done1',
person_id = p_person_id
WHERE employee_number = hr_data.employee_number;
EXCEPTION
WHEN OTHERS
THEN
p_validate := NULL;
p_effective_date := NULL;
p_person_id := NULL;
v_api_error := NULL;
v_error_msg := NULL;
v_api_error := SQLERRM;
v_error_msg := v_error_msg || ' ' || v_api_error;
UPDATE xx_hr_upload_master_data_ets
SET error_msg = v_error_msg,
emp_data = 'T_Error'
WHERE employee_number = hr_data.employee_number;
COMMIT;
END;
COMMIT;
END LOOP;
END;
v_api_error VARCHAR2 (5000);
v_error_msg VARCHAR2 (5000) := NULL;
p_person_id NUMBER;
----------------------------------
p_validate BOOLEAN;
p_effective_date DATE;
p_warn_ee VARCHAR2 (5000);
BEGIN
FOR hr_data IN (SELECT xx.*
FROM xx_hr_upload_master_data_ets xx
where xx.EMPLOYEE_NUMBER in ('1','2'))
-- WHERE NVL (xx.emp_data, 'T_Error') <> 'Done')
LOOP
BEGIN
p_validate := FALSE;
SELECT person_id, effective_start_date
INTO p_person_id, p_effective_date
FROM per_all_people_f
WHERE employee_number = hr_data.employee_number
AND effective_end_date > SYSDATE
AND business_group_id = hr_data.business_group_id;
hr_change_start_date_api.update_start_date
(p_validate => p_validate,
p_person_id => p_person_id,
p_old_start_date => p_effective_date,
p_new_start_date => hr_data.hire_date,
p_update_type => 'CORRECTION',
p_warn_ee => p_warn_ee
);
UPDATE xx_hr_upload_master_data_ets
SET emp_data = 'Done1',
error_msg = 'Done1',
person_id = p_person_id
WHERE employee_number = hr_data.employee_number;
EXCEPTION
WHEN OTHERS
THEN
p_validate := NULL;
p_effective_date := NULL;
p_person_id := NULL;
v_api_error := NULL;
v_error_msg := NULL;
v_api_error := SQLERRM;
v_error_msg := v_error_msg || ' ' || v_api_error;
UPDATE xx_hr_upload_master_data_ets
SET error_msg = v_error_msg,
emp_data = 'T_Error'
WHERE employee_number = hr_data.employee_number;
COMMIT;
END;
COMMIT;
END LOOP;
END;