首页 >数据库 >mysql教程 >mysql触发器跳出当前循环方法_MySQL

mysql触发器跳出当前循环方法_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-01 13:36:121854浏览

bitsCN.com

mysql触发器跳出当前循环方法

 

set @num=@UnitLength/3;

label:

while i

     set @length=(select SUBSTRING(@unit_sid_fk,1,@UnitLength-3*i));

     set @sms_content=(select sms_content from sms_config where  sms_
type='smsCall' and unit_sid_fk=@length);

     set @sms_counts=(select sms_counts from sms_config where sms_
type='smsCall'and unit_sid_fk=@length);

     if @sms_content is not null then      

       insert into sms_task set mt_at_time=@date,mt_content=@sms_content,unit_
sid_fk=@unit_sid_fk,mt_
dst_num=@calltelephone,mt_add_time=@date,mt_group_id=@groupid,branch
_num=@sms_counts,mt_dst_size='1',sms_channel='SMSPORT',mt_type_id='99';

       set New.sms_send='Y';     

 leave label;

     end if;

set i=i+1;

end while;

   www.bitsCN.com  

在while循环外面添加label: 用 leave label; 即可跳出当前循环。
 

bitsCN.com
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn