Operation Details
Description: Searches existing programs of type "closed" on the Integrated Case, except those of type "Cost Sharing". Returns the latest end date.
Sterotype: ns
SQL
SELECT
  CaseHeader.endDate
INTO
  :endDate 
FROM
  CaseHeader,
  ProductDelivery 
WHERE CaseHeader.integratedCaseID = :caseID 
  AND CaseHeader.caseID = ProductDelivery.caseID 
  AND ProductDelivery.productID <> :productID1 
  AND ProductDelivery.productID <> :productID2 
  AND CaseHeader.statusCode = :statusCode 
  AND CaseHeader.endDate = ( 
  SELECT
    MAX(endDate) 
  FROM
    CaseHeader 
  )