先进入mysql命令行环境
![](http://images.51cto.com/files/uploadimg/20101009/1635380.jpg)
然后创建函数,先要选择数据库
delimiter $$是设置 $$为命令终止符号,代替分号 ,因为分号有其他用处
![](http://images.51cto.com/files/uploadimg/20101009/1635381.jpg)
现在恢复分号做终止符号,调用函数
![](http://images.51cto.com/files/uploadimg/20101009/1635382.jpg)
删除函数
![](http://images.51cto.com/files/uploadimg/20101009/1635383.jpg)
php这样调用 mysql_query("select quqiufeng('字段名')");
存储过程
先delimiter $$
![](http://images.51cto.com/files/uploadimg/20101009/1635384.jpg)
call quqiufeng();//调用mysql存储过程
先进入mysql命令行环境
转载于:https://www.cnblogs.com/sevensole7/p/3143967.html