Search This Blog

Tuesday, June 28, 2011

Changing Hire Date of Employee

Scenario: Current emp data in the system has wrong DOJ, need to correct for all the employees:

CREATE
TABLE XXHR_EMP_DOJ(PERSON_ID NUMBER,ORACLE_START_DATE DATE,ACTUAL_START_DATE DATE);
DECLARE
CURSOR cur_dataISSELECT papf.employee_number, dej.person_id,papf

.start_date oracle_start_date, dej.actual_start_dateFROM xxhr_emp_doj dej, per_all_people_f papfWHERE papf.person_id = dej.person_id;o_warn_ee
BEGIN
VARCHAR2 (20);
FOR i IN cur_dataLOOPBEGIN
hr_change_start_date_api.update_start_date(p_validate => FALSE,p_person_id => i.person_id,p_old_start_date => i.oracle_start_date,p_new_start_date => i.actual_start_date,p_update_type => 'E',p_applicant_number => NULL,p_warn_ee
=> o_warn_ee);DBMS_OUTPUT.put_line ( 'Success - Employee Number:'|| i
.employee_number);EXCEPTIONWHEN OTHERSTHENDBMS_OUTPUT.put_line ( 'Error Employee Number:'|| i
||
.employee_number' Message -'|| SQLERRM);END;
END;
END LOOP;

No comments:

Post a Comment