SELECT
CaseHeader.caseID,
CaseHeader.caseReference,
CaseHeader.caseTypeCode,
CaseHeader.startDate,
CaseHeader.statusCode,
ConcernRole.concernRoleID,
ConcernRole.concernRoleName,
ConcernRole.concernRoleType,
CRCG.concernRoleName
INTO
:caseID,
:caseReference,
:caseTypeCode,
:startDate,
:statusCode,
:concernRoleID,
:concernRoleName,
:concernRoleType,
:iCClientsOpt
FROM
ConcernRole,
CaseHeader
LEFT JOIN
CaseGroups
ON
CaseHeader.caseID = CaseGroups.CaseID AND CASEGROUPS.GROUPCODE= 'CG3'
LEFT JOIN
ConcernRole CRCG
ON CRCG.CONCERNROLEID= CASEGROUPS.CONCERNROLEID
WHERE CaseHeader.integratedCaseID = :caseID
AND
(
CaseHeader.caseTypeCode = :caseTypeCode
OR :caseTypeCode IS NULL
)
AND ConcernRole.concernRoleID = CaseHeader.concernRoleID
|