Mysql trigger jumps out of the current loop method set @ num = @ UnitLength/3; label: while I <@ num do 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.2cto.com Add a label outside the while loop: Use leave label; to jump out of the current loop.