-- Synchronize hte PO_Current table with PO_Bitemp
INSERT INTO PO_Current
 SELECT customer_number, property_number FROM PO_Bitemp
 WHERE TT_Stop = TO_DATE( '12/31/9999', 'MM/DD/YYYY' ) AND
       VT_Begin = SYSDATE;

DELETE FROM PO_Current
WHERE EXISTS
 ( SELECT * FROM PO_Bitemp AS B
   WHERE PO_Current.customer_number = B.customer_number AND
         PO_Current.property_number = B.property_number AND
         TT_Stop = TO_DATE( '12/31/9999', 'MM/DD/YYYY' ) AND
         VT_End = SYSDATE
 );
