Wednesday, 9 March 2016

API to Delete Absence Attendances

API to Delete Absence Attendances


DECLARE
   CURSOR get_absence
   IS
      SELECT absence_attendance_id, object_version_number
        FROM per_absence_attendances
       WHERE TRUNC (creation_date) = TRUNC (SYSDATE);
BEGIN
   FOR fetch_absence IN get_absence
   LOOP
      BEGIN
         hr_person_absence_api.
          delete_person_absence (
            p_validate                => FALSE,
            p_absence_attendance_id   => fetch_absence.absence_attendance_id,
            p_object_version_number   => fetch_absence.object_version_number);
         COMMIT;
         DBMS_OUTPUT.
          put_line (
            fetch_absence.absence_attendance_id
            || ' has been deleted Successfully !!!');
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.
             put_line (
                  'Inner Exception: '
               || fetch_absence.absence_attendance_id
               || ' - - '
               || SQLERRM);
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);

END;

1 comment: