Mysql带返回值与不带返回值的2种存储过程


过程1:带返回值:

1 drop procedure if exists proc_addNum;
2 create procedure proc_addNum (in x int,in y int,out sum int)
3 BEGIN
4 SET sum= x + y;
5 end

然后,执行过程,out输出返回值:

1 call proc_addNum(2,3,@sum);
2 select @sum;

过程2:不带返回值:

1 drop procedure if exists proc_addNum;
2 create procedure proc_addNum (in x int,in y int)
3 BEGIN
4 DECLARE sum int;
5 SET sum= x + y;
6 SELECT sum;
7 end

执行过程:

1 call proc_addNum(2,3);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM