mysql中declare语句⽤法_mysqldeclare怎么⽤Q4:mysql declare cursor只能放在前⾯吗
本⽂中介绍了⼀个MySQL的存储过程,其中涉及Cursor的使⽤typedefstruct数组
⽰例如下:
复制代码
mysql怎么读英语代码如下:
全屏轮播代码CREATE PROCEDURE `justifyGroupNum`()
NOT DETERMINISTIC
SQL SECURITY DEFINER
COMMENT
BEGIN
/*how to run:call justifyGroupNum()*/
DECLARE p_group_id int;
declare p_num int;
declare stopFlag int;
DECLARE cursor_name CURSOR
mvc三层架构m是什么FOR select c_group_id,count(*) as num
from `t_group_member`
where
c_valid in (3,4)
group by c_group_id;
DECLARE CONTINUE HANDLER FOR NOT
FOUND set stopFlag=1;
OPEN cursor_name;
REPEAT
FETCH cursor_name
INTO p_group_id,p_num;
begin
update t_groupinfo set
c_member_number=p_num where c_group_id=p_group_id;
end;
安装eclipse过程UNTIL stopFlag =
1
END REPEAT;
CLOSE cursor_name;
END;
总结:
1、注意设置游标的countinue handler:DECLARE CONTINUE HANDLER FOR NOT FOUND set stopFlag=1;
css颜透明度怎么设置2、注意REPEAT和UTILE [停⽌条件] END REPEAT的使⽤,否则不会循环;
3、如何RUN,输⼊并执⾏:call justifyGroupNum()
WWw.yIjITao.CO.m
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论