Sometimes we end up in a situation to close notifications in bulk, in such situation we can use “wf_notification.close” API. Below is the script to close all OPEN notifications of an Item Type XX_NOTIF.
declare
--
-- +=====================================================
-- | Purpose : To close email notification
-- | Author : Shailender Thallam
-- +=====================================================
--
CURSOR cur_list_notifications
IS
--
--Modify the below query as per your requirement
--
SELECT item_key,
notification_id,
recipient_role
FROM wf_notifications
where 1 = 1
and message_type like 'XX_NOTIF'
AND status = 'OPEN';
--
--
l_item_key wf_notifications.item_key%type;
--
--
BEGIN
--
FOR i IN cur_list_notifications
LOOP
BEGIN
--
wf_notification.close(i.notification_id,'SYSADMIN');
dbms_output.put_line ('Closing Notification ID: '||i.notification_id);
--
END;
END LOOP;
--
COMMIT;
--
END close_sample_creation_notif;