注意参数格式: in 参数名字 类型
-- 创建存储过程 通过参数作为 sql中的条件
create procedure testCunChu(in x int)
begin
select * from sc where CID=x ;
set x=x+1;
end;
-- 调用存储过程
-- 第一种方式:
set @x=‘01‘;
call testCunChu(@x);
-- 查询@x参与存储过程中被修改后,in不影响@x的值 @x其实就是 存储过程的参数x
select @x;
-- 第二种方式
call testCunChu(01);
原文:https://www.cnblogs.com/liyunchuan/p/10712397.html