SELECT
ta.taskID,
t.assignedDateTime,
t.wdoSnapshot,
p.name,
w.deadlineTime,
t.priority,
t.status,
t.versionNo
INTO
:taskID,
:assignedDateTime,
:subject,
:assignedTo,
:taskDeadlineDateTime,
:taskPriority,
:status,
:versionNo
FROM
TaskAssignment ta,
Position p,
Task t
LEFT OUTER JOIN
WorkFlowDeadLine w
ON w.taskID = t.taskID
WHERE ta.taskID = t.taskID
AND t.status NOT IN( :taskCompleted, :taskClosed)
AND ta.relatedID = p.positionID
AND ta.assigneeType = :assigneeType
AND t.reservedBy IS NULL
AND ta.relatedID IN
(
SELECT
DISTINCT p.positionID
FROM
Users u ,
PositionHolderLink ph ,
Position p
WHERE u.userName = :relatedName
AND u.userName = ph.userName
AND ph.positionID = p.positionID
AND
(
:searchByRelatedIDInd = '0'
OR p.positionID = :relatedID
)
AND ph.recordStatus = :recordStatus
AND :currentDate >= ph.fromDate
AND
(
:currentDate <= ph.toDate
OR ph.toDate IS NULL
)
)
|