mysql声明游标的方法
mysql声明游标的方法: 1、声明变量和游标 declare result varchar(3000); declare flag1 varchar(100); DECLARE done INT DEFAULT FALSE; declare cur1 CURSOR FOR SELECT flag from bmlx; 2、变量赋值 DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; set result = ''; 3、打开游标和循环 open cur1; read_loop: LOOP — 给游标赋值 FETCH cur1
用户评论