Operation Details
Description: Gets the list of out of use 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 outofuseperiod  
     WHERE  
     startDateTime <= :currentDateTime AND
    (endDateTime is NULL OR endDateTime >= :currentDateTime)
    )