How to delete (drop) an Oracle AQ queue?

Evandro Pomatti picture Evandro Pomatti · Nov 11, 2016 · Viewed 12.6k times · Source

I wish to drop an Oracle AQ queue and the table associated with it.

What are the commands needed to perform this operation?

Answer

Evandro Pomatti picture Evandro Pomatti · Nov 11, 2016

In order to delete the queue and the table associated with it, the steps are:

  1. Stop the queue
  2. Drop the queue
  3. Drop the queue table (optional)

The following command will remove the queue and table.

BEGIN
  DBMS_AQADM.STOP_QUEUE(queue_name => 'QUEUE_NAME');
  DBMS_AQADM.DROP_QUEUE(queue_name => 'QUEUE_NAME');
  DBMS_AQADM.DROP_QUEUE_TABLE(queue_table => 'QUEUE_TABLE_NAME');
END;

You don't need to drop the table, but it is usually the case when executing this operation.