DROP PROCEDURE IF EXISTS `rpadownloadmanage`;
delimiter ;;
CREATE PROCEDURE `rpadownloadmanage`()
BEGIN
DECLARE ASCENECODE VARCHAR(50) DEFAULT "";
DECLARE AUGID VARCHAR(150) DEFAULT "";
DECLARE AYHDM int(10) DEFAULT 0;
DECLARE AVERSION VARCHAR(36) DEFAULT "";
DECLARE AXSMC VARCHAR(36) DEFAULT "";
DECLARE AORGNAME VARCHAR(36) DEFAULT "";
DECLARE done INT DEFAULT 0;
DECLARE scene cursor for SELECT SCENECODE, VERSION, UGID,YHDM,XSMC,ORGNAME FROM T_PORTAL_RPA_SCENE GROUP BY SCENECODE, VERSION;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
open scene;
REPEAT
fetch scene into ASCENECODE, AVERSION, AUGID,AYHDM,AXSMC,AORGNAME;
if not done THEN
UPDATE RPADOWNLOADMANAGE SET UGID = AUGID, YHDM=AYHDM, XSMC=AXSMC, ORGNAME=AORGNAME WHERE ROBOTID=ASCENECODE AND VERSION = AVERSION;
end if;
until done end repeat;
close scene;
commit;
END
;;
delimiter ;
call rpadownloadmanage();