使用Mysql 存储过程和游标进行同步数据
-- UpdateUserData是同步数据需要具体执行的步骤,AsyncUserData是控制UpdateUserData的条件。 DROP PROCEDURE IF EXISTS UpdateUserData; DROP PROCEDURE IF EXISTS AsyncUserData; DELIMITER // CREATE PROCEDURE `UpdateUserData`(IN id int(11)) BEGIN DECLARE classidstr VARCHAR(500); DECLARE gradeidstr VARCHAR(500); DECLARE stageidstr VARCHAR(500); DECLARE childidstr VARCHAR(500); select CONCAT("[", GROUP_CONCAT( "\"",tb_child.class_id ,"\""), "]") into classidstr from tb_child where patriarch_id=id; select CONCAT("[", GROUP_CONCAT(tb_child.grade_id), "]") into gradeidstr from tb_child where patriarch_id=id; select CONCAT("[",