Operation Details
Description: count all the records by supervisor status and case status
Sterotype: ns
SQL
SELECT
  COUNT(*)
INTO
  :value 
FROM
  CaseHeader,
  CaseUserRole,
  OrgObjectLink 
WHERE OrgObjectLink.userName = :ownerID 
  AND OrgObjectLink.orgObjectLinkID = CaseUserRole.orgObjectLinkID 
  AND 
  (
    CaseUserRole.recordStatus = :statusCode 
    OR :statusCode IS NULL 
  ) 
  AND 
  (
    CaseUserRole.typeCode = :typeCode 
    OR :typeCode IS NULL 
  ) 
  AND 
  (
    CaseHeader.statusCode = :caseStatusCode 
    OR :caseStatusCode IS NULL 
  ) 
  AND CaseHeader.caseID = CaseUserRole.caseID