1、语法格式
DELIMITER $$
CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
PROCEDURE `test`.`sp_name`( in args1 int,out args2 int)
/*LANGUAGE SQL
| [NOT] DETERMINISTIC
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| COMMENT 'string'*/
BEGIN
END$$
DELIMITER ;
2、调用存储过程
call sp_name(args1,args2);
3、查询创建的存储过程
1)select * from mysql.proc where db='数据库名';
2)select * from information_schema.routines where routine_schema='数据库名';
3)show procedure status where db='数据库名';
查看存储过程的定义
show create procedure 数据库名.存储过程名;