Wednesday, February 17, 2016

API to Delete Benefit Person Actions



DECLARE
   CURSOR c1
   IS
      SELECT act.*
        FROM ben_person_actions act, per_all_people_f per
       WHERE     act.person_id = per.person_id
             AND TRUNC (SYSDATE) BETWEEN per.effective_start_date
                                     AND per.effective_end_date
             AND per.business_group_id = 10665;
BEGIN
   FOR i IN c1
   LOOP
      BEGIN
         ben_person_actions_api.delete_person_actions (
            p_validate                => FALSE,
            p_person_action_id        => i.person_action_id,
            p_object_version_number   => i.object_version_number,
            p_effective_date          => SYSDATE);
         COMMIT;

         DBMS_OUTPUT.put_line (
            i.person_action_id || ' has been Deleted Successfully !!!');
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line (
               'Failure:  ' || i.person_action_id || ' - ' || SQLERRM);
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);
END;

No comments:

Post a Comment