zoukankan      html  css  js  c++  java
  • mysql触发

    create procedure agex(in addage1 int,in addage2 int)
    begin
    declare curl_stu_id int;
    declare curl_stu_sex varchar(5);
    declare done int default 0;
    declare curl_student cursor for select stu_id,stu_sex from t_student;
    declare continue handler for not found set done=1; //若没有数据返回则将变量done设置为1
    open curl_student;
    repeat
    fetch curl_student into curl_stu_id,curl_stu_sex;
    if not done then
    if curl_stu_Sex='男' then
    update t_student set age=age+addage1 where stu_id=curl_stu_id;
    else
    update t_student set age=age+addage2 where stu_id=curl_stu_id;
    end if;
    end if;
    until done end repeat;
    close curl_student;
    end

  • 相关阅读:
    spring boot 配置时区差别
    概率期望
    Euler函数与Euler定理
    素数&筛法
    等差子序列
    8.19 T2
    8.19 T1
    量化交易
    挺进

  • 原文地址:https://www.cnblogs.com/mengluo/p/5381749.html
Copyright © 2011-2022 走看看