Operation Details
Description: Reads the active planned goal id and goal contract text for a service plan id by language code and case id.
Sterotype: ns
SQL
SELECT
  PlannedGoal.plannedGoalID,
  SE.contractText
INTO
  :plannedGoalID,
  :goalContractText 
FROM
  (GoalContractText INNER JOIN
  ( 
  SELECT
    ContractText,
    contractTextID 
  FROM
    ContractText
  WHERE ContractText.languageCode = :languageCode 
  ) SE 
  ON GoalContractText.contractTextID = SE.contractTextID
  ) 
  
RIGHT JOIN
  PlannedGoal 
  ON GoalContractText.goalID = PlannedGoal.goalID 
WHERE PlannedGoal.caseID = :caseID