The queue's view DELAY_TIMESTAMP column appears to have the correct time, but when compared to SYSTIMESTAMP, there's an unexpected five hour difference. After the message should have gone to the READY state, it is still in the WAIT state.
For example, a message is enqueued using DBMS_AQ.ENQUEUE with delay of 60 seconds. I wait till well after the message should be dequeued. The message is still in the queue despite attempting to dequeue it with DBMS_AQ.DEQUEUE. Here is what the query looks like.
select delay_timestamp, systimestamp , delay_timestamp - systimestamp
DELAY_TIMESTAMP = 7/1/2009 8:23:05.769546 PM
SYSTIMESTAMP = 7/1/2009 9:06:23.944861 PM +00:00
MP +00 04:16:41.824685
The difference should be negative because the time should have expired. However, it's positive, exactly 5 hours less the time since it was enqueued.
This code worked fine until it was re-installed as part of dropping and creating the Oracle user. It works fine on Oracle XE and other databases. The problem is consistent with some change having been done either in Oracle or the Unix operating system. I don't have control over those systems and the administrator says nothing changed. Oracle has been stopped and started since the problem was noticed. The queue table was then dropped and recreated.
Do you have any idea as to what could cause the difference? It looks like a difference between GMT and CDT time zones. It could be related to the session time zone.
It is Oracle 10g 10.2.0.4.0.
w_obj := NEW obj();
w_message_properties.delay := 60;
dbms_aq.enqueue(queue_name => 'AQ.THE_QUEUE',
enqueue_options => w_enqueue_options,
message_properties => w_message_properties,
payload => w_obj,
msgid => w_message_handle);