Mysql带返回值与不带返回值的2种存储过程写法
过程1:带返回值:
drop procedure if exists proc_addNum; create procedure proc_addNum (in x int,in y int,out sum int) BEGIN SET sum= x + y; end
然后,执行过程,out输出返回值:
call proc_addNum(2,3,@sum); select @sum;
过程2:不带返回值:
drop procedure if exists proc_addNum; create procedure proc_addNum (in x int,in y int) BEGIN DECLARE sum int; SET sum= x + y; SELECT sum; end
执行过程:
call proc_addNum(2,3);
总结
以上所述是小编给大家介绍的Mysql带返回值与不带返回值的2种存储过程写法,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!
相关推荐
GoatSucker 2020-01-24
huanglianhuabj00 2015-10-25
83510998 2020-07-18
thickbookszone 2020-06-14
xiaonamylove 2020-06-14
天高任鸟飞 2020-06-04
Magicsoftware 2020-06-01
Reiki 2020-05-04
小菜鸟的代码世界 2020-05-04
whynotgonow 2020-04-26
zcyuefan 2020-04-19
神龙 2020-02-10
ajaxtony 2020-02-03
HongKongPython 2020-01-30
liuyang000 2020-01-24
zhiyuan0 2020-01-06