var my_action VARCHAR2(30);
exec :my_action:='bulk delete';

@login
select sysdate from dual;

exec DBMS_APPLICATION_INFO.SET_ACTION (action_name => :my_action); 

DECLARE
  TYPE id_col_table_type IS TABLE OF SAMPLE.RANDOM_DATA_LOAD.id_col%TYPE;
  id_col_table id_col_table_type;

BEGIN
  -- Retrieve data to be deleted in bulk
  SELECT id_col BULK COLLECT INTO id_col_table FROM SAMPLE.RANDOM_DATA_LOAD WHERE date_col <= date'2022-06-15';

  -- Perform bulk delete
  FORALL i IN 1..id_col_table.COUNT
    DELETE FROM SAMPLE.RANDOM_DATA_LOAD WHERE id_col = id_col_table(i);

  COMMIT;
END;
/

select sysdate from dual;

exec DBMS_APPLICATION_INFO.SET_ACTION (action_name => NULL);

