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 ;