ITPub博客

首页 > 数据库 > MySQL > 存储过程

存储过程

原创 MySQL 作者:starive 时间:2014-09-02 11:24:30 0 删除 编辑
创建存储过程
create procedure 过程名([参数1,参数2,...])
BEGIN 
   SQL语句代码块 
END 


修改存储过程
 ALTER PROCEDURE  存储过程名 SQL语句代码块 


执行存储过程
call  过程名([参数1,参数2,...])


删除存储过程
drop procedure [IF EXISTS] 过程名;

查看存储过程的状态

  1. mysql> show procedure status like 'film_in_stock'\G
  2. *************************** 1. row ***************************
  3.                   Db: starive
  4.                 Name: film_in_stock
  5.                 Type: PROCEDURE
  6.              Definer: root@localhost
  7.             Modified: 2014-09-02 13:48:25
  8.              Created: 2014-09-02 13:48:25
  9.        Security_type: DEFINER
  10.              Comment:
  11. character_set_client: utf8
  12. collation_connection: utf8_general_ci
  13.   Database Collation: latin1_swedish_ci
  14. 1 row in set (0.02 sec)



查看存储过程的定义

  1. show create procedure 函数名

通过查看information_schema.Routines了解存储过程和函数的信息

  1. select *from routines where routine_name = 'film_in_stock' \G



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26435490/viewspace-1261981/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 函数
下一篇: 光标
请登录后发表评论 登录
全部评论

注册时间:2014-01-18

  • 博文量
    143
  • 访问量
    530075