SELECT
t.taskID,
t.priority,
t.reservedBy,
u.fullName,
t.assignedDateTime,
t.wdoSnapshot,
t.overflowInd,
t.versionNo
INTO
:taskID,
:taskPriority,
:taskReservedByUserName,
:taskReservedByFullUserName,
:taskAssignedDateTime,
:taskWDOSnapshot,
:taskWDOOverflowInd,
:versionNo
FROM
Task t
LEFT OUTER JOIN
Users u
ON (t.reservedBy = u.userName)
LEFT OUTER JOIN
WorkflowDeadline w
ON (t.taskID = w.taskID)
WHERE w.deadlineTime >= :fromDeadlineDateTime
AND w.deadlineTime < :toDeadlineDateTime
AND
(
t.taskID IN
(
SELECT
taskID
FROM
TaskAssignment u
WHERE u.relatedName = :userName
AND u.assigneeType = 'RL9'
)
)
AND
(
(
:allOrgUnitTasksInd = '0'
OR
(
t.reservedBy IS NULL
OR t.reservedBy IS NOT NULL
)
)
AND
(
:allReservedOrgUnitTasksInd = '0'
OR t.reservedBy = :userName
)
AND
(
:allAssignedOrgUnitTasksInd = '0'
OR t.reservedBy IS NULL
)
)
ORDER BY t.assignedDateTime ASC
|