博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql sp
阅读量:4213 次
发布时间:2019-05-26

本文共 601 字,大约阅读时间需要 2 分钟。

drop procedure if exists p_update_platform;
delimiter $$ 
create  procedure p_update_platform(in p_platform_id int,in p_platform_name varchar(50),in p_shop_id int,out p_num int)
begin 
set p_num=1;
WHILE 
exists(select 1 from sale_order where shop_id=p_shop_id and platform_id is null)
 and p_num<=10
do
update sale_order set platform_id=p_platform_id,platform_name=p_platform_name where shop_id=p_shop_id and platform_id is null limit 1;
set p_num=p_num+1;
end while ;
end ;
$$ 
delimiter ;
set @platform_id=1010,@platform_name='天猫',@shop_id=35;
call p_update_platform(1010,'天猫', 35,@p_num);
select @p_num;

转载地址:http://slfmi.baihongyu.com/

你可能感兴趣的文章
聊聊分布式事务,再说说解决方案
查看>>
JDK8的新特性——Lambda表达式
查看>>
java.lang.OutOfMemoryError: Java heap space 内存溢出问题排查
查看>>
linux 网络对时
查看>>
maven 下载 工程依赖的所有jar包到本地
查看>>
Intellij IDEA 自动生成 serialVersionUID
查看>>
Intellij 中执行maven 命令 assembly
查看>>
maven构件搜索网站
查看>>
Intellij 如果让Maven projects 中显示maven plugins
查看>>
IntelliJ 代码规范检查设置
查看>>
Eclipse生成jar包后,Spring无法扫描到bean定义。
查看>>
JVM 编译优化 静态常量会被添加到当前类的“常量池”中,无需加载引用类(常量不加载/常量找不到/常量不更新)
查看>>
手动释放linux内存cache
查看>>
MyBatis特殊字符转义
查看>>
Intellij IDEA 自动生成 serialVersionUID
查看>>
Intellij 中执行maven 命令 assembly
查看>>
maven构件搜索网站
查看>>
Intellij 如果让Maven projects 中显示maven plugins
查看>>
mysql in 查询 按in的顺序来排序
查看>>
excel 在一列中查找某个值的出现次数 countif函数
查看>>