Operation Details
Description:  
Sterotype: nsmulti
SQL
SELECT 
OutcomePlanAction.outcomePlanActionID,
  OutcomePlanAction.outcomePlanActionAdminID,
  OutcomePlanAction.outcomePlanID,
  OutcomePlanAction.name,
  OutcomePlanAction.reason,
  OutcomePlanAction.startDate,
  OutcomePlanAction.endDate,
  OutcomePlanAction.frequency,
  OutcomePlanAction.durationInMinutes,
  OutcomePlanAction.cost,
  OutcomePlanAction.actualCost,
  OutcomePlanAction.sensitivity,
  OutcomePlanAction.outcome,
  OutcomePlanAction.outcomeComments,
  OutcomePlanAction.status,
  OutcomePlanAction.owner,
  OutcomePlanAction.responsibilityRelatedType,
  OutcomePlanAction.responsibilityRelatedID,
  OutcomePlanAction.federalAllowableComponentID,
  OutcomePlanAction.noteID,
  OutcomePlanAction.outcomeReason,
  OutcomePlanAction.creationDate,
  OutcomePlanAction.createdBy,
  OutcomePlanAction.versionNo
INTO :outcomePlanActionID,
  :outcomePlanActionAdminID,
  :outcomePlanID,
  :name,
  :reason,
  :startDate,
  :endDate,
  :frequency,
  :durationInMinutes,
  :cost,
  :actualCost,
  :sensitivity,
  :outcome,
  :outcomeComments,
  :status,
  :owner,
  :responsibilityRelatedType,
  :responsibilityRelatedID,
  :federalAllowableComponentID,
  :noteID,
  :outcomeReason,
  :creationDate,
  :createdBy,
  :versionNo

FROM OutcomePlanAction 
 INNER JOIN OUTCOMEPLANACTIONROLE  ON (OutcomePlanAction.outcomePlanActionID = OutcomePlanActionRole.outcomePlanActionID)
INNER JOIN  CaseParticipantRole ON (OutcomePlanActionRole.caseParticipantRoleID = CaseParticipantRole.caseParticipantRoleID)

WHERE STATUS   != 'OPAS10004'
  AND (
	(name = :name AND outcomePlanActionAdminID IS NULL) 
	OR (outcomePlanActionAdminID  =:outcomePlanActionAdminID) 
	)
AND (
  startDate <= :endDate 
  AND (endDate >= :startDate OR endDate IS NULL)
)
AND 
(CaseParticipantRole.participantRoleID = :concernRoleID)