1.在notepad中编写如下存储过程pr_del并保存为pr_del.sql

存储过程练习一

 

 2.在命令行中(Windows下的cmd)登陆MYSQL控制台

存储过程练习一

3.将pr_del.sql文件中的存储过程导入进来(执行sql脚本)

  mysql> source D:\mywork\SQL\pr_add.sql

4.在命令行中查询数据库中的存储过程:

mysql> select body from mysql.proc where specific_name='pr_del'

存储过程练习一

方法一:(直接查询)
select `specific_name` from mysql.proc where db = 'your_db_name' and `type` = 'procedure'
方法二:(查看数据库里所有存储过程+内容)
show procedure status;
方法三:(查看当前数据库里存储过程列表)
select specific_name from mysql.proc ;
方法四:(查看某一个存储过程的具体内容)
select body from mysql.proc where specific_name = 'your_proc_name';
查看存储过程或函数的创建代码 :
show create procedure your_proc_name;
show create function your_func_name;
删除存储过程:
drop procedure your_proc_name;

5.调用存储过程

mysql> call pr_del(34,11);

 存储过程练习一

 

相关文章:

  • 2022-01-20
  • 2021-09-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案