# out其实就是cpp里的引用变量,in就是值传递CREATEPROCEDURE p_count(OUT count int)BEGINSELECTCOUNT(*)into count FROM student;ENDset@num=10;# 定义变量CALL p_count(@num);#我的数据有11条SELECT@numas num;#这里的num已经是11了--这个就是一个调用参数的函数CREATEPROCEDURE p_studnt_selectById(in id int)BEGINSELECT*FROM student WHERE studentNo = id;ENDCALL p_studnt_selectById(4)
两个参数
#两个参数是一样的用法CREATEPROCEDURE p_result_test(out num int,in id int)BEGINSELECTCOUNT(*)INTO num FROM result WHERE studentNo = id;ENDset@num=0;CALL p_result_test(@num,3);SELECT@numas num