Operation Details
Description:  
Sterotype: nsmulti
SQL
SELECT
  RelatedInvestigationRole.participantRoleType,
  RelatedInvestigationRole.investigationParticipantInd
INTO
  :participantRoleType,
  :investigationParticipantInd
FROM (
SELECT
  CaseParticipantRole.typeCode participantRoleType,
  '1'  investigationParticipantInd
FROM
  CaseParticipantRole
WHERE CaseParticipantRole.caseID = :caseID
  AND CaseParticipantRole.participantRoleID = :concernRoleID
  AND CaseParticipantRole.recordStatus = :recordStatus
  AND (CaseParticipantRole.typeCode = :participantTypePrimary OR CaseParticipantRole.typeCode = :participantTypeMember)
UNION
SELECT DISTINCT
  AllegationRole.roleType participantRoleType,
  '0' investigationParticipantInd
FROM
  Allegation,
  AllegationRole,
  CaseParticipantRole
WHERE Allegation.caseID = :caseID
  AND Allegation.recordStatus = :recordStatus
  AND Allegation.allegationID = AllegationRole.allegationID
  AND AllegationRole.caseParticipantRoleID = CaseParticipantRole.caseParticipantRoleID
  AND CaseParticipantRole.typeCode <> :participantTypeAllegationReporter
  AND CaseParticipantRole.participantRoleID = :concernRoleID) RelatedInvestigationRole