Mysql trigger jump out of current loop method

Source: Internet
Author: User

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.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.