SELECT CASEID, MAX(CHANGEDATETIME), CHANGEUSER, EFFECTIVEFROM, EVIDENCECHANGEHISTORY.EVIDENCEDESCRIPTORID, EVIDENCETYPE, NEWIND, PARTICIPANTID, PENDINGREMOVALIND, PENDINGUPDATEIND, RECEIVEDDATE, RELATEDID, STATUSCODE, SUCCESSIONID, VERSIONNO, CHANGEREASON, EVIDENCEACTIVATIONDATE, CORRECTIONSETID
INTO :caseID, :changeDateTime, :changeUser, :effectiveFrom, :evidenceDescriptorID, :evidenceType, :newInd, :participantID, :pendingRemovalInd, :pendingUpdateInd, :receivedDate, :relatedID, :statusCode, :successionID, :versionNo, :changeReason, :evidenceActivationDate, :correctionSetID
FROM EVIDENCEDESCRIPTOR, EVIDENCECHANGEHISTORY
WHERE SUCCESSIONID = :successionID
AND (STATUSCODE = 'EDS1' OR STATUSCODE = 'EDS2')
AND (PARTICIPANTID = :participantID OR PARTICIPANTID IS NULL)
AND EVIDENCECHANGEHISTORY.EVIDENCEDESCRIPTORID = EVIDENCEDESCRIPTOR.EVIDENCEDESCRIPTORID
AND CASEID = :caseID
AND EVIDENCETYPE = :evidenceType
GROUP BY RELATEDID, CHANGEUSER, CHANGEREASON, CORRECTIONSETID, CASEID, EFFECTIVEFROM, EVIDENCECHANGEHISTORY.EVIDENCEDESCRIPTORID, EVIDENCETYPE, NEWIND, PARTICIPANTID, PENDINGREMOVALIND, PENDINGUPDATEIND, RECEIVEDDATE, STATUSCODE, SUCCESSIONID, VERSIONNO, EVIDENCEACTIVATIONDATE
ORDER BY EFFECTIVEFROM;
|