SELECT
CaseEvidence.evidenceID,
CaseEvidence.assessmentID,
CaseEvidence.caseID,
CaseEvidence.effectiveFrom,
CaseEvidence.statusCode,
CaseEvidence.versionNo
INTO
:evidenceID,
:assessmentID,
:caseID,
:effectiveFrom,
:statusCode,
:versionNo
FROM
CaseEvidence,
CaseHeader,
Assessment
WHERE
(
CaseEvidence.caseID = CaseHeader.integratedCaseID
OR CaseEvidence.caseID = CaseHeader.caseID
)
AND CaseHeader.caseID = :caseID
AND Assessment.assessmentID = :assessmentID
AND EXISTS
(
SELECT
*
FROM
CaseEvidenceType,
CaseEvidence,
EvidenceForm,
ProductEvidenceFormLink
WHERE CaseEvidenceType.evidenceID = CaseEvidence.evidenceID
AND
(
ProductEvidenceFormLink.productID = :productID
OR :productIDIsNull <> '0'
)
AND EvidenceForm.evidenceFormID = ProductEvidenceFormLink.evidenceFormID
AND EvidenceForm.evidenceNameCode = CaseEvidenceType.evidenceFormName
)
|