-- Temporally vacuum old non-current entities from the archival store
-- if no recent history or transactions are present
DELETE FROM Prop_Owner
WHERE SYSDATE - TT_Stop > 731 AND
      NOT EXISTS
      ( SELECT * FROM Prop_Owner R
        WHERE TT_STop = TO_DATE( '12/31/9999', 'MM/DD/YYYY' ) AND
              SYSDATE - VT_End > 731 AND
              customer_number = R.customer_number AND
              property_number = R.property_number
      );
