SiebelUnleashed Forum is up and running.. Check out the new forum. | Next Tip »Home

SQL – extracting the workflow queue.

OkAvarageGoodVery GoodExcellent (No Ratings Yet)
Loading ... Loading ...

This query has been shared by a “Svetj” a member of SiebelUnleashed forum. I find it quite useful in case if I work in admin and need to know the workflow queue.

It shows

  • The actual queue for a workflow policy group with the insert date of the next record to work so you can know the actual delay of the backlog.
  • How many records have been processed in the last hour, with the date of the last record processed.
    So you can know if the workflow is going on.

Here is the query.

SELECT cnt
      ,code_status
      ,dt_description
      ,to_char(dt,’dd/mm/yyyy hh24.mi.ss’) dt
      ,dd||’ days ‘||hh||’:'||mi||’:'||ss ||’ hours’ delay
FROM   (SELECT COUNT(0) cnt
              ,’Queue’ code_status
              ,’Date of next record to examinate:’ dt_description
              ,MIN(req.created) dt
              ,trunc(86400*(SYSDATE-MIN(req.created)))-60*(trunc((86400*(SYSDATE-MIN(req.created)))/60)) ss,
               trunc((86400*(SYSDATE-MIN(req.created)))/60)-60*(trunc(((86400*(SYSDATE-MIN(req.created)))/60)/60)) mi,
               trunc(((86400*(SYSDATE-MIN(req.created)))/60)/60)-24*(trunc((((86400*(SYSDATE-MIN(req.created)))/60)/60)/24)) hh,
               trunc((((86400*(SYSDATE-MIN(req.created)))/60)/60)/24) dd
        FROM   siebel.s_escl_req   req
              ,siebel.s_escl_group grp
        WHERE  req.group_id = grp.row_id
        AND    grp.NAME = ‘Your Gruoup Name’
        UNION
        SELECT COUNT(0) cnt
              ,’Processed’ code_status
              ,’Last record processed on:’ dt_description
              ,MAX(lg.created) dt,
               trunc(86400*(SYSDATE-MAX(lg.created)))-60*(trunc((86400*(SYSDATE-MAX(lg.created)))/60)) ss,
               trunc((86400*(SYSDATE-MAX(lg.created)))/60)-60*(trunc(((86400*(SYSDATE-MAX(lg.created)))/60)/60)) mi,
               trunc(((86400*(SYSDATE-MAX(lg.created)))/60)/60)-24*(trunc((((86400*(SYSDATE-MAX(lg.created)))/60)/60)/24)) hh,
               trunc((((86400*(SYSDATE-MAX(lg.created)))/60)/60)/24) dd
        FROM   siebel.s_escl_log   lg
              ,siebel.s_escl_rule  rul
              ,siebel.s_escl_group grp
        WHERE  lg.rule_id = rul.row_id
        AND    rul.group_id = grp.row_id
        AND    grp.NAME = ‘Your Gruoup Name’
        AND    lg.created > SYSDATE – 1 / 24)
ORDER  BY code_status DESC

Related Posts


Article by neel

Authors bio is coming up shortly. neel tagged this post with: Read 416 articles by neel
blog comments powered by Disqus

Polls

Do you know how to use replace function?

View Results

Loading ... Loading ...