zoukankan      html  css  js  c++  java
  • Mysql存储过程

    1.创建存储过程

    mysql> delimiter $
    mysql> create procedure pro_user()
        -> begin
        ->     select * from tb_user;
        -> end $

    2.查看当前数据库的存储过程

    mysql> use book;
    mysql> show procedure status;
    +------+-------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
    | Db   | Name        | Type      | Definer        | Modified            | Created             | Security_type | Comment | character_set_client | collation_connection | Database Collation |
    +------+-------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
    | book | findAllBook | PROCEDURE | root@localhost | 2016-09-04 11:13:31 | 2016-09-04 11:13:31 | DEFINER       |         | gbk                  | gbk_chinese_ci       | utf8_general_ci    |
    | book | pro_test    | PROCEDURE | root@localhost | 2016-11-13 08:27:17 | 2016-11-13 08:27:17 | DEFINER       |         | gbk                  | gbk_chinese_ci       | utf8_general_ci    |
    | book | pro_user    | PROCEDURE | root@localhost | 2016-11-13 08:44:34 | 2016-11-13 08:44:34 | DEFINER       |         | gbk                  | gbk_chinese_ci       | utf8_general_ci    |
    +------+-------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
    3 rows in set (0.01 sec)


    mysql> show create procedure findAllBook;
    +-------------+------------------------+---------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+
    | Procedure | sql_mode | Create Procedure | character_set_client | collation_connection | Database Collation |
    +-------------+------------------------+---------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+
    | findAllBook | NO_ENGINE_SUBSTITUTION | CREATE DEFINER=`root`@`localhost` PROCEDURE `findAllBook`()
    begin
    select * from tb_books;
    end | gbk | gbk_chinese_ci | utf8_general_ci |
    +-------------+------------------------+---------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+
    1 row in set (0.00 sec)

  • 相关阅读:
    通过源码安装PostgresSQL
    mysql 8.0.16 单主 mgr搭建
    美团点评SQL优化工具SQLAdvisor开源快捷部署
    通过springboot 去创建和提交一个表单(七)
    在springboot中验证表单信息(六)
    调度任务(五)
    接收上传的multi-file的文件(四)
    消费Restful的web服务(三)
    关于RabbitMQ服务器整合(二)
    在springboot中用redis实现消息队列
  • 原文地址:https://www.cnblogs.com/shootercheng/p/6058101.html
Copyright © 2011-2022 走看看