-- Create triggers for maintaining the PO_Archive table as PO_History
-- is modified
CREATE OR REPLACE TRIGGER Delete_PO
AFTER DELETE ON PO_History FOR EACH ROW
BEGIN
 INSERT INTO PO_Archive VALUES
 ( :old.customer_number, :old.property_number, :old.VT_Begin,
   :old.VT_End, :old.TT_Start, SYSDATE );
END;
/

CREATE OR REPLACE TRIGGER Update_PO
AFTER DELETE ON PO_History FOR EACH ROW
BEGIN
 INSERT INTO PO_Archive VALUES
 ( :old.customer_number, :old.property_number, :old.VT_Begin,
   :old.VT_End, :old.TT_Start, SYSDATE );
END;
/
