-- A current update to reflect Peter Olsen buying the flat on 1/15/1998
-- Full implementation considering both valid and transaction times
INSERT INTO Prop_Owner
  SELECT 827, property_number, SYSDATE, VT_End, SYSDATE, 
         TO_DATE( '12/31/9999', 'MM/DD/YYYY' )
  FROM Prop_Owner
  WHERE property_number = 7797
    AND VT_Begin <= SYSDATE
    AND VT_End > SYSDATE
    AND TT_Stop = TO_DATE( '12/31/9999', 'MM/DD/YYYY' );

INSERT INTO Prop_Owner
  SELECT customer_number, property_number, VT_Begin, SYSDATE, SYSDATE,
         TO_DATE( '12/31/9999', 'MM/DD/YYYY' )
  FROM Prop_Owner
  WHERE property_number = 7797
    AND VT_Begin < SYSDATE
    AND VT_End > SYSDATE
    AND TT_Stop = TO_DATE( '12/31/9999', 'MM/DD/YYYY' );

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

INSERT INTO Prop_Owner
  SELECT 827, property_number, VT_Begin, VT_End, SYSDATE, 
         TO_DATE( '12/31/9999', 'MM/DD/YYYY' )
  FROM Prop_Owner
  WHERE property_number = 7797
    AND VT_Begin > SYSDATE
    AND TT_Stop = TO_DATE( '12/31/9999', 'MM/DD/YYYY' );

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





