过程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:不带返回值:

Mysql带返回值与不带返回值的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
Mysql带返回值与不带返回值的2种存储过程

执行过程:

1 call proc_addNum(2,3);

 

相关文章:

  • 2021-10-15
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-08
  • 2022-02-24
  • 2022-12-23
  • 2021-11-12
  • 2021-09-28
相关资源
相似解决方案