Declare
CURSOR c_emp_cur
IS
SELECT ppos.period_of_service_id, ppos.object_version_number,
papf.person_type_id, yte.termination_date end_date, yte.ID
FROM per_all_people_f papf,
per_periods_of_service ppos,
ynppo_temp_employee yte
WHERE papf.person_id = ppos.person_id
AND SYSDATE BETWEEN papf.effective_start_date
AND papf.effective_end_date
AND SYSDATE BETWEEN ppos.date_start
AND COALESCE (ppos.projected_termination_date,
actual_termination_date,
SYSDATE
)
AND yte.employee_code = papf.employee_number
AND yte.flag = 'T'
AND yte.status IS NULL;
l_validate BOOLEAN := FALSE;
l_period_of_service_id NUMBER;
l_object_version_number NUMBER;
l_actual_notice_period_date DATE;
l_effective_date DATE;
l_supervisor_warning BOOLEAN;
l_event_warning BOOLEAN;
l_interview_warning BOOLEAN;
l_review_warning BOOLEAN;
l_recruiter_warning BOOLEAN;
l_asg_future_changes_warning BOOLEAN;
l_f_asg_future_changes_warning BOOLEAN;
l_pay_proposal_warning BOOLEAN;
l_dod_warning BOOLEAN;
l_final_process_date DATE;
l_org_now_no_manager_warning BOOLEAN;
l_entries_changed_warning VARCHAR2 (255);
l_f_entries_changed_warning VARCHAR2 (255);
l_alu_change_warning VARCHAR2 (255);
l_person_type_id NUMBER;
l_last_std_process_date_out DATE;
BEGIN
FOR c_emp_rec IN c_emp_cur
LOOP
l_period_of_service_id := c_emp_rec.period_of_service_id;
l_object_version_number := c_emp_rec.object_version_number;
l_actual_notice_period_date := c_emp_rec.end_date;
l_effective_date := c_emp_rec.end_date;
l_person_type_id := c_emp_rec.person_type_id;
BEGIN
hr_ex_employee_api.actual_termination_emp
(p_validate => l_validate,
p_effective_date => l_effective_date,
p_period_of_service_id => l_period_of_service_id,
p_object_version_number => l_object_version_number,
p_actual_termination_date => l_actual_notice_period_date,
p_last_standard_process_date => l_actual_notice_period_date,
--p_person_type_id => l_person_type_id,
--,p_leaving_reason => 'RESS'
p_last_std_process_date_out => l_last_std_process_date_out,
p_supervisor_warning => l_supervisor_warning,
p_event_warning => l_event_warning,
p_interview_warning => l_interview_warning,
p_review_warning => l_review_warning,
p_recruiter_warning => l_recruiter_warning,
p_asg_future_changes_warning => l_asg_future_changes_warning,
p_entries_changed_warning => l_entries_changed_warning,
p_pay_proposal_warning => l_pay_proposal_warning,
p_dod_warning => l_dod_warning,
p_alu_change_warning => l_alu_change_warning
);
UPDATE ynppo_temp_employee
SET status = 'Terminated'
WHERE ID = c_emp_rec.ID;
EXCEPTION
WHEN OTHERS
THEN
UPDATE ynppo_temp_employee
SET status = 'Not Terminated'
WHERE ID = c_emp_rec.ID;
dbms_output.put_line(SQLERRM);
END;
END LOOP;
END;
The
YNPPO_TEMP_EMPLOYEE is staging table to store employee data which will be
terminated using API.
No comments:
Post a Comment