I need the following output
- Queue Name: Name of the queue
- State: 0 Ready,1 Waiting, 2 Processed, 3 Expired - of the queue table
- Count: count the number of records in the queue table of that state.
Example
Queue Name State Count
---------------------------------------
Email_Q Processed 5939
Email_response_Q Waiting 133
I constructed the following SQL
SELECT 'select ''' || owner || '.' || name || ''' queue_name,
decode(state,0,''Ready'',1,''Waiting'',2,''Processed'',3,''Expired'',''?'') state,
count(*) count
from ' || owner || '.' || queue_table ||
' where q_name = ''' || name || ''' group by state' cmd
FROM all_queues
WHERE owner IN ('AMADEUS')
ORDER BY owner, name;
I am able to construct all the selects for the Queue tables. But I would like to get the output using a select statement.
I was thinking of pipeline functions or use of a global temporary tables. Any help will be much appreciated.