SELECT DISTINCT
CaseHeader.caseID,
CaseHeader.concernRoleID,
CaseHeader.caseReference,
CaseHeader.statusCode,
CaseHeader.caseTypeCode,
CaseHeader.lastWritten,
ConcernRole.concernRoleName,
ConcernRole.primaryAlternateId
INTO
:caseID,
:concernRoleID,
:caseReference,
:statusCode,
:caseTypeCode,
:lastWritten,
:concernRoleName,
:primaryAlternateId
FROM
CaseHeader,
ConcernRole,
CaseUserRole,
OrgObjectLink
WHERE OrgObjectLink.userName = :userName
AND OrgObjectLink.orgObjectLinkID = CaseUserRole.orgObjectLinkID
AND CaseHeader.ownerOrgObjectLinkID = CaseUserRole.orgObjectLinkID
AND CaseUserRole.caseID = CaseHeader.caseID
AND CaseHeader.concernRoleID = ConcernRole.concernRoleID
AND NOT CaseHeader.statusCode = :statusCode
ORDER BY ConcernRole.concernRoleName ASC
|