SELECT
placeID,
P.compartmentID,
P.name,
type,
startDate,
endDate,
startDateTime,
endDateTime,
P.recordStatus,
P.versionNo
INTO
:placeID,
:compartmentID,
:name,
:type,
:startDate,
:endDate,
:startDateTime,
:endDateTime,
:recordStatus,
:versionNo
FROM Place P, Compartment C
WHERE
P.compartmentID= C.compartmentID
AND (parentCompartmentID = :compartmentID OR C.compartmentID = :compartmentID)
AND P.recordStatus= :recordStatus
AND (P.endDate is NULL OR P.endDate >= :currentDate)
AND
placeID IN
(
SELECT Place.placeID
FROM Reservation, Place
WHERE
Reservation.placeID = Place.placeID AND
type = :type AND
Reservation.fromDate <= :currentDateTime AND
(Reservation.toDate is NULL OR Reservation.toDate>= :currentDateTime )
)
|