Monday, October 28, 2013

API to Delete Organization Classification

DECLARE
   CURSOR fetch_details
   IS
      SELECT hoi.*
        FROM hr_all_organization_units haou, hr_organization_information hoi
       WHERE haou.organization_id = hoi.organization_id;
BEGIN
   FOR i IN fetch_details
   LOOP
      BEGIN
         hr_organization_api.
          disable_org_classification (
            p_validate                => FALSE,
            p_effective_date          => SYSDATE,
            p_org_information_id      => i.org_information_id,
            p_org_info_type_code      => i.org_information_context,
            p_object_version_number   => i.object_version_number);

         COMMIT;

         DBMS_OUTPUT.
          put_line (i.org_information_id || ' has been deleted  !!!');
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.
             put_line (
                  'Failure: '
               || i.org_information_id
               || ' could not  be deleted  !!!'
               || SQLERRM);
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);

END;

1 comment: