SELECT
Place.placeID,
Place.compartmentID,
Place.name,
Place.type,
Place.startDate,
Place.startDateTime,
Place.endDate,
Place.endDateTime,
Place.recordStatus,
Place.versionNo
INTO
:placeID,
:compartmentID,
:name,
:type,
:startDate,
:startDateTime,
:endDate,
:endDateTime,
:recordStatus,
:versionNo
FROM
Place,
Outofuseperiod
WHERE
Place.compartmentId =:compartmentID
AND Place.recordStatus <> :recordStatus
AND Outofuseperiod.placeid = Place.placeid
AND (
( Outofuseperiod.startDateTime IS NULL
AND Outofuseperiod.startDate <= :date )
OR Outofuseperiod.startDateTime <= :placementDatetime
)
AND (
(Outofuseperiod.endDateTime IS NULL
AND ( Outofuseperiod.endDate IS NULL
OR Outofuseperiod.endDate >= :date)
)OR Outofuseperiod.endDateTime >= :placementDatetime
)
|