Mysql创建存储过程

来源:互联网 发布:淘宝手持照片怎么拍 编辑:程序博客网 时间:2024/06/06 06:56

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 数据库名.存储过程名;

原创粉丝点击