Operation Details
Description: Counts the number of active appeal cases the appealed case is already on.
Sterotype: ns
SQL
SELECT
  COUNT(*)
INTO
  :recordCount 
FROM
  AppealRelationship,
  CaseHeader 
WHERE AppealRelationship.caseID = :caseID 
  AND AppealRelationship.appealCaseID = CaseHeader.caseID 
  AND AppealRelationship.recordStatus = :normalRecordStatus 
  AND 
  (
    CaseHeader.statusCode = :activeStatusCode 
    OR CaseHeader.statusCode = :openStatusCode 
    OR CaseHeader.statusCode = :approvedStatusCode 
  )