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 ;

上一篇:java – 三次样条插值的正确实现


下一篇:Velodyne VLP16激光雷达的使用(base on 树莓派 ubuntu 18.04) Label:Research