Creates a queue.


You can use the following syntax to define a new queue:

CREATE QUEUE name QUEUE TABLE queue_table_name [ ( { option_name option_value} [, ... ] ) ]

The following section describes valid values of the option_name and option_value parameters.

TYPE [normal_queue | exception_queue]


You can use the CREATE QUEUE command to create a queue in the current database if you are a superuser or a user who has the aq_administrator_role privilege.

If a queue name is schema-qualified, the queue is created in the specified schema. Otherwise, the queue is created in the current schema. A queue can only be created in the schema in which the queue table resides. A queue name must be unique in the schema.

  • PolarDB for Oracle provides additional syntax of the CREATE QUEUE SQL command. You can use this additional syntax with the DBMS_AQADM package.
  • You can use the DROP QUEUE command to delete a queue.


Parameter Description
name The name of the sequence to be created. The name can be schema-qualified.
queue_table_name The name of the queue table that is associated with the queue.
option_name option_value The names and values of options that are associated with the new queue. If the call to the CREATE QUEUE TABLE includes duplicate option names, the server returns an error. The following section describes valid values of these two parameters:
  • TYPE: specifies whether a queue is a normal queue or exception queue. Valid values: normal_queue and exception_queue. The exception queue only supports dequeuing operations.
  • RETRIES: specifies the maximum number of attempts to delete a message from the queue. Data type: INTEGER.
  • RETRYDELAY: specifies the number of seconds after a rollback that the server waits before retrying the message. Data type: DOUBLE PRECISION.
  • RETENTION: specifies the number of seconds for which a message is stored in the queue table after dequeuing. Data type: DOUBLE PRECISION.


Run the following command to create a queue named work_order that is associated with the queue table named work_order_table:

CREATE QUEUE work_order QUEUE TABLE work_order_table (RETRIES 5, RETRYDELAY 2);

The server allows five attempts to delete messages from the queue and requires an interval of 2 seconds between two retry attempts.