直接上代码:
/*数据库 - udi_ems_test*********************************************************************内容:在plan_material_summary_info总表中删除数据前,对当前数据进行备份,保存至plan_material_summary_info_backup中*/DELIMITER $$USE `udi_ems_test`$$DROP TRIGGER IF EXISTS `plan_material_summary_info_trigger`$$CREATE /*!50017 DEFINER = ‘root‘@‘%‘ */ TRIGGER `plan_material_summary_info_trigger` BEFORE DELETE ON `plan_material_summary_info` FOR EACH ROW BEGIN INSERT INTO plan_material_summary_info_backup SELECT * FROM plan_material_summary_info WHERE id=old.id; END;$$DELIMITER ;具体讲解如下地址:1.http://blog.sina.com.cn/s/blog_62b080970100nxw1.html(删除前备份数据)2.https://www.cnblogs.com/duodushu/p/5446384.html(触发器资料)3.https://blog.csdn.net/tonysong111073/article/details/99286229(实例)
原文地址:https://www.cnblogs.com/ysq0908/p/11457960.html
时间: 2024-10-01 07:24:30