SELECT
CaseHeader.caseReference,
ConcernRole.concernRoleName,
ConcernRole.concernRoleType,
CaseHeader.caseTypeCode,
CaseHeader.statusCode,
CaseHeader.caseID,
CaseHeader.concernRoleID,
UserRecentAction.actionDateTime,
UserRecentAction.userName,
CaseTransactionLog.userName
INTO
:caseReference,
:concernRoleName,
:concernRoleType,
:caseTypeCode,
:statusCode,
:caseID,
:concernRoleID,
:approvedDateTime,
:approvedByUserName,
:submittedByUserName
FROM CaseHeader, ConcernRole, UserRecentAction, CaseTransactionLog
WHERE CaseHeader.concernRoleID = ConcernRole.concernRoleID
AND CaseHeader.caseID = UserRecentAction.referenceNo
AND UserRecentAction.referenceNo = CaseHeader.caseID
AND UserRecentAction.type = :userRecentActionType
AND UserRecentAction.actionDateTime >= :actionDateTime
AND UserRecentAction.actionType = :userRecentActionActionType
AND CaseHeader.caseID = CaseTransactionLog.caseID
AND CaseTransactionLog.transactionType = :caseTransactionTypeCode
AND CaseTransactionLog.transactionDateTime <= UserRecentAction.actionDateTime
AND CaseTransactionLog.userName = :submittedByUserName
|