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