Operation Details
Description: This fetches the list of work queues that are subscribed by the user jobs.
Sterotype: nsmulti
SQL
SELECT
  wq.name,
  wq.workQueueID,
  wqs.subscriberID,
  j.name AS subscriberName,
  wqs.subscriberType,
  wqs.subscriptionDateTime
INTO
  :workQueueName,
  :workQueueID,
  :subscriberID,
  :subscriberName,
  :subscriberType,
  :subscriptionDateTime 
FROM
  WorkQueue wq,
  WorkQueueSubscription wqs,
  Job j 
WHERE wq.workQueueID = wqs.workQueueID 
  AND wqs.subscriberType = :subscriberType 
  AND j.jobID = wqs.subscriberID 
  AND wqs.subscriberID IN 
  ( 
  SELECT
    DISTINCT j.jobID 
  FROM
    Users u,
    PositionHolderLink ph,
    Position p,
    Job j 
  WHERE u.userName = :userName 
    AND u.userName = ph.userName 
    AND ph.positionID = p.positionID 
    AND j.jobID = p.jobID 
    AND ph.recordStatus = :recordStatus 
    AND 
    (
      
      (
        ph.fromDate <= :currentDate 
        AND ph.toDate IS NULL 
      ) 
      OR 
      (
        ph.fromDate <= :currentDate 
        AND ph.toDate >= :currentDate 
      ) 
    ) 
  ) 
ORDER BY wq.name