1.存储过程的调用(无参)
存储过程调用的时候使用的call
语法为call procedure_name() ,如:
call proc_demo()
2.存储过程的调用(带参)
语法为call procedure_name(参数列表),
首先创建一个带参的存储过程
create procedure proc_demo(in param_id int, out countnumber int)beginselect count(*) from t_user where id >= param_id; #select count(*) into countnumber from t_user where id >= param_id; end
然后调用存储过程
#设置传入参数变量并赋值#set @param_id = 11;#调用存储过程#call proc_demo(@param_id,@countnumber)#直接写参数调用call proc_demo(11, @countnumber);#查询结果#select @countnumber;
返回相应的结果
