-- Current time deletion of Peter Olsen's flat
-- Complete implementation considering transaction and valid times
INSERT INTO Prop_Owner
  SELECT customer_number, property_number, 
         VT_Begin, TO_DATE( '01/20/1998', 'MM/DD/YYYY' ), 
         TO_DATE( '01/20/1998', 'MM/DD/YYYY' ),
         TO_DATE( '12/31/9999', 'MM/DD/YYYY' )
  FROM Prop_Owner
  WHERE property_number = 7797
    AND VT_Begin < TO_DATE( '01/20/1998', 'MM/DD/YYYY' )
    AND VT_End > TO_DATE( '01/20/1998', 'MM/DD/YYYY' )
    AND TT_Stop = TO_DATE( '12/31/9999', 'MM/DD/YYYY' );

UPDATE Prop_Owner
SET TT_Stop = TO_DATE( '01/20/1998', 'MM/DD/YYYY' )
WHERE property_number = 7797
  AND VT_Begin < TO_DATE( '01/20/1998', 'MM/DD/YYYY' )
  AND VT_End > TO_DATE( '01/20/1998', 'MM/DD/YYYY' )
  AND TT_Stop = TO_DATE( '12/31/9999', 'MM/DD/YYYY' );

UPDATE Prop_Owner
SET TT_Stop = TO_DATE( '01/20/1998', 'MM/DD/YYYY' )
WHERE property_number = 7797
  AND VT_Begin >= TO_DATE( '01/20/1998', 'MM/DD/YYYY' )
  AND TT_Stop = TO_DATE( '12/31/9999', 'MM/DD/YYYY' );

