Thursday, April 4, 2013

API to Delete Element Entries in Oracle Payroll


DECLARE
   l_effective_start_date   DATE;
   l_effective_end_date     DATE;
   l_delete_warning         BOOLEAN;

   CURSOR c1
   IS
      SELECT   * FROM PAY_ELEMENT_ENTRIES_F;
BEGIN
   FOR i IN c1
   LOOP
      BEGIN
         pay_element_entry_api.delete_element_entry (
            p_datetrack_delete_mode   => 'DELETE',
            p_effective_date          => SYSDATE,
            p_element_entry_id        => i.element_entry_id,
            p_object_version_number   => i.object_version_number,
            p_effective_start_date    => l_effective_start_date,
            p_effective_end_date      => l_effective_end_date,
            p_delete_warning          => l_delete_warning
         );

         COMMIT;

         DBMS_OUTPUT.put_line (
            i.element_entry_id || '  - Element has been Deleted !!!'
         );
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line (
               'Element Exception: ' || i.element_entry_id || '-' || SQLERRM
            );
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      ROLLBACK;
      DBMS_OUTPUT.put_line (SQLERRM);
END;
/

No comments:

Post a Comment