Operation Details
Description: To read the sum of the amount field based on CaseID, FinInstructID, Category, Status and CdtDbtType.
Sterotype: ns
SQL
SELECT
  SUM (CASE 
    WHEN InstructionLineItem.creditDebitType = :creditDebitType 
    THEN -amount 
    ELSE amount 
  END
  ) amount
INTO
  :amount 
FROM
  InstructionLineItem 
WHERE InstructionLineItem.caseID = :caseID 
  AND InstructionLineItem.finInstructionID = :finInstructionID 
  AND InstructionLineItem.instructLineItemCategory = :instructLineItemCategory