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