SELECT
CaseNote.caseNoteID,
CaseNote.caseID,
CaseNote.recordStatus,
Note.sensitivityCode,
Note.creationDateTime,
Note.priorityCode,
Users.fullName,
Note.userName,
Note.notesText,
Note.subjectText,
CaseNote.versionNo,
CaseNote.noteID
INTO
:caseNoteID,
:caseID,
:recordStatus,
:sensitivityCode,
:creationDateTime,
:priorityCode,
:fullname,
:userName,
:notesText,
:subjectText,
:versionNo,
:noteID
FROM
Note,
CaseNote,
Users
WHERE CaseNote.caseID = :caseID
AND Note.noteID = CaseNote.noteID
AND Note.userName = Users.userName
UNION ALL
SELECT
CaseNote.caseNoteID,
CaseNote.caseID,
CaseNote.recordStatus,
Note.sensitivityCode,
Note.creationDateTime,
Note.priorityCode,
ExternalUser.fullName,
Note.userName,
Note.notesText,
Note.subjectText,
CaseNote.versionNo,
CaseNote.noteID
FROM
Note,
CaseNote,
ExternalUser
WHERE CaseNote.caseID = :caseID
AND Note.noteID = CaseNote.noteID
AND Note.userName = ExternalUser.userName
|