SELECT
tr.taskRedirectionID,
tr.blockTaskAllocation,
tr.startDateTime,
tr.endDateTime,
tr.fromUserName,
tr.toUserName,
tr.toRedirectID,
tr.toRedirectType
INTO
:taskRedirectionID,
:blockTaskAllocation,
:startDateTime,
:endDateTime,
:fromUserName,
:toUserName,
:toRedirectID,
:toRedirectType
FROM
TaskRedirection tr
WHERE tr.fromUserName = :fromUserName
AND
(
(
:startDateTime >= tr.startDateTime
AND :startDateTime <= tr.endDateTime
)
OR
(
:endDateTime >= tr.startDateTime
AND :endDateTime <= tr.endDateTime
)
OR
(
:startDateTime < tr.startDateTime
AND :endDateTime > tr.endDateTime
)
OR
(
(
:endDateTimeIsNull = '1'
)
AND
(
(
tr.endDateTime > :startDateTime
)
OR
(
tr.endDateTime IS NULL
)
)
)
OR
(
(
tr.endDateTime IS NULL
)
AND
(
:endDateTime > tr.startDateTime
)
)
)
|