SELECT
IssueDelivery.caseID,
IssueDelivery.issueType,
IssueCaseHeader.caseReference,
RelatedCaseHeader.caseID,
RelatedCaseHeader.caseReference,
ConcernRole.concernRoleID,
ConcernRole.concernRoleName,
ConcernRole.concernRoleType
INTO
:issueDeliveryCaseID,
:issueType,
:issueCaseReference,
:relatedCaseID,
:relatedCaseReference,
:concernRoleID,
:concernRoleName,
:concernRoleType
FROM
CaseHeader IssueCaseHeader,
CaseHeader RelatedCaseHeader,
ConcernRole,
IssueDelivery
WHERE
(
:caseReference IS NULL
OR RelatedCaseHeader.caseReference = :caseReference
AND IssueDelivery.relatedCaseID = RelatedCaseHeader.caseID
AND IssueCaseHeader.caseID = IssueDelivery.caseID
)
AND
(
:issueReference IS NULL
OR IssueCaseHeader.caseReference = :issueReference
AND IssueDelivery.caseID = IssueCaseHeader.caseID
AND RelatedCaseHeader.caseID = IssueDelivery.relatedCaseID
)
AND
(
:concernRoleIDIsNull <>'0'
OR IssueCaseHeader.concernRoleID = :concernRoleID
AND IssueCaseHeader.caseTypeCode = 'CT10'
AND IssueDelivery.caseID = IssueCaseHeader.caseID
AND RelatedCaseHeader.caseID = IssueDelivery.relatedCaseID
)
AND
(
ConcernRole.concernRoleID = IssueCaseHeader.concernRoleID
)
|