mysql自定义函数多表更新:update_order_relation()
作者:互联网
DELIMITER $$
USE `local_hnyz`$$
DROP FUNCTION IF EXISTS `update_order_relation`$$
CREATE DEFINER=`root`@`localhost` FUNCTION `update_order_relation`(orderId VARCHAR(64)) RETURNS VARCHAR(64) CHARSET utf8
BEGIN
DECLARE new_orderId VARCHAR(64);
SET new_orderId = REPLACE(UUID(),'-','');
UPDATE se_seal_order SET ID=new_orderId WHERE ID=orderId;
UPDATE se_seal_order_seal SET SEAL_ORDER_ID=new_orderId WHERE SEAL_ORDER_ID=orderId;
UPDATE se_seal_order_attachment SET seal_order_id=new_orderId WHERE seal_order_id=orderId;
RETURN new_orderId;
END$$
DELIMITER ;
标签:orderId,SET,多表,自定义,update,ID,seal,new,order 来源: https://www.cnblogs.com/sung1024/p/11362018.html