DEQUEUE
DEQUEUE#
Syntax#
dequeue ::=#
fifo_option ::=#
Description#
The DEQUEUE statement retrieves a message that satisfies the condition in where_clause and then deletes it.
fifo_option#
If the FIFO option is enabled, or if neither FIFO nor LIFO has been specified, the oldest message that satisfies the condition is retrieved. If the LIFO option is enabled, the newest message is retrieved.
WAIT integer#
The DEQUEUE statement waits until a message has been added to the queue when there are no messages. The DEQUEUE waits for a period of time specified in the WAIT clause, and the time unit of standby time can be second(sec), millisecond(msec,1/1000 sec),and μsec(μsec,1/1000000 sec). The second is applied unless otherwise specified. If the stand by time is not specified, the DEQUEUE statement will be infinitively awaiting.
Considerations#
The following should be taken into consideration when using the DEQUEUE statement:
- Only the names of columns in a queue table can be specified in queue_column_list.
- The DEQUEUE statement has some of the characteristics of the SELECT statement. However, the name of only one queue table can be specified in the FROM clause of a DEQUEUE statement. If more than one queue table is specified, an error will be raised.
- A subquery cannot be used in the WHERE clause of a DEQUEUE statement.
Example#
<Query> Read all messages having the Correlation ID 237 from message queue Q1.
DEQUEUE MESSAGE, CORRID FROM Q1 WHERE CORRID=237;