Operation Details
Description: Gets the list of occupied places for a compartment at current time.
Sterotype: nsmulti
SQL
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 placeID
     FROM placement  
     WHERE  
     recordStatus= :recordStatus  AND
     startDate <= :currentDateTime AND
     (endDate is NULL OR endDate >= :currentDateTime) 
    )