Operation Details
Description: Gets the list of emergency 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 Place.placeID
     FROM Placement, Place
     WHERE  
     Placement.placeID = Place.placeID AND
     Place.type = :type AND
     Placement.recordStatus= :recordStatus  AND
     Placement.startDate <= :currentDateTime AND 
     (Placement.endDate is NULL OR Placement.endDate >= :currentDateTime) 
    )