Home >Database >Mysql Tutorial >mysql存储过程简单学习_MySQL

mysql存储过程简单学习_MySQL

WBOY
WBOYOriginal
2016-06-01 13:43:22904browse

bitsCN.com

1.创建mysql存储过程p3 (先更改结束符 delimiter $)
 create procedure p3(IN nameid int, OUT person_name varchar(10))  nameid是传进来的参数,person_name是输出类型的参数
 begin 
 select * from t_user; 
 select name into person_name from t_user where id = nameid; 
 end 
 $ 
2.DOS下执行
 执行存储过程 call ps(1,@a)-->返回结果集(若有)
                select @a-->获得输出类型实参

总之存储过程是一个批量高效执行sql



本文来自于 panguixiang 的BLOG bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn