Wednesday, January 1, 2014

API to Delete Person

DECLARE
   CURSOR c1
   IS
      SELECT *
        FROM per_all_people_f
       WHERE person_id = 2421;

   l_person_org_manager_warning   VARCHAR2 (1000) := NULL;
BEGIN
   FOR i IN c1
   LOOP
      BEGIN
         hr_person_api.
          delete_person (
            p_validate                     => FALSE,
            p_effective_date               => i.effective_start_date,
            p_person_id                    => i.person_id,
            p_person_org_manager_warning   => l_person_org_manager_warning);
         COMMIT;

         DBMS_OUTPUT.
          put_line (
            i.employee_number || ' has been deleted successfully !!!!');
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.
             put_line (
               i.employee_number || ' - ' || ' Exception: ' || SQLERRM);
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);

END;

No comments:

Post a Comment