Mysql带返回值与不带返回值的2种存储过程写法男
过程1:带返回值:
Mysql带返回值与不带返回值的2种存储过程写法,mysql存储过程
过程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种存储过程写法,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!
http://www.bkjia.com/Mysql/1230843.htmlwww.bkjia.comtruehttp://www.bkjia.com/Mysql/1230843.htmlTechArticleMysql带返回值与不带返回值的2种存储过程写法,mysql存储过程 过程1:带返回值: drop procedure if exists proc_addNum; create procedure proc_addNum (in x...
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:不带返回值:
本文由美洲杯波胆发布于计算机教程,转载请注明出处:Mysql带返回值与不带返回值的2种存储过程写法男
关键词: