zoukankan      html  css  js  c++  java
  • mysql (:kabel_name:loop...end loop"; "repeat....end repeat";"while ... do .... end while"

    drop PROCEDURE if exists test1;
    create procedure test1()
    begin
        declare i int;
        set i=1;
    while i<=30 do
            update blog.car1_myarticle 
            set blog.car1_myarticle.brief_content=i
            where car1_myarticle.id=i;
            set i=i+1;
    end while;
    end;
    ----------------------------------------
    drop PROCEDURE if exists test1;
    create procedure test1()
    begin
        declare i int;
        set i=1;
    exit_a:loop  -- 定义一个标签为 "exit_a"
            update blog.car1_myarticle 
            set blog.car1_myarticle.brief_content=i
            where car1_myarticle.id=i;
            set i=i+1;
        if i>30 THEN
            LEAVE exit_a;  -- 离开指定的标签 "exit_a"
        end if;
    end loop;
    end;
    ----------------------------------------
    drop procedure if EXISTS test1;
    create procedure test3()
    begin
        declare i,n int;
        set i=1;
        set n=30;
    REPEAT
                update blog.car1_myarticle 
                set blog.car1_myarticle.brief_content=i
                where car1_myarticle.id=i;
    set i=i+1;
    until i>n
    end REPEAT;
    end;
  • 相关阅读:
    测试用例怎么写
    002-利润计算
    001-无重复数字组合
    ftp上传与gui button的练习
    文件操作
    py2exe制作python可执行.exe的setup.py
    猜数字大小的游戏
    GUI简单例子学习
    新的旅程
    回车键搜索兼容性问题
  • 原文地址:https://www.cnblogs.com/vmsysjack/p/13055978.html
Copyright © 2011-2022 走看看