Thursday, March 27, 2014

API to Delete Events or Classes

DECLARE
   CURSOR c1
   IS
      SELECT *
        FROM ota_events
       WHERE business_group_id = 1107;
BEGIN
   FOR i IN c1
   LOOP
      BEGIN
         OTA_EVENT_API.
          delete_class (p_validate                => FALSE,
                        p_event_id                => i.event_id,
                        p_object_version_number   => i.object_version_number);
         COMMIT;
         DBMS_OUTPUT.put_line (i.event_id || ' has been deleted ');
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.
             put_line ('Inner Exception: ' || SQLERRM || ' - ' || i.event_id);
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);

END;

No comments:

Post a Comment