Tuesday, May 7, 2013

API to Delete Salary Proposal


DECLARE
   CURSOR fetch_det
   IS
      SELECT   *
        FROM   per_pay_proposals
       WHERE   TRUNC (SYSDATE) BETWEEN change_date AND date_to;

   l_salary_warning   BOOLEAN;
   l_err_msg          VARCHAR2 (500);
BEGIN
   FOR i IN fetch_det
   LOOP
      BEGIN
         hr_maintain_proposal_api.delete_salary_proposal (
            p_pay_proposal_id         => i.pay_proposal_id,
            p_business_group_id       => i.business_group_id,
            p_object_version_number   => i.object_version_number,
            p_validate                => FALSE,
            p_salary_warning          => l_salary_warning
         );
         COMMIT;
         DBMS_OUTPUT.put_line (
            'Proposal has been Deleted: ' || i.pay_proposal_id
         );

         COMMIT;
      EXCEPTION
         WHEN OTHERS
         THEN
            l_err_msg := SQLERRM;
            DBMS_OUTPUT.put_line ('Inner Exception: ' || l_err_msg);
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      l_err_msg := SQLERRM;
      DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END;

1 comment:

  1. Bijoy - thank you for the script - it worked great. Appreciate you sharing your expertise.

    Danny

    ReplyDelete