码迷,mamicode.com
首页 > 数据库 > 详细

数据库-mysql储存过程

时间:2017-08-06 12:52:19      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:iad   pre   0 rows   maria   adb   create   log   数据   数据库   

存储过程是一个SQL语句集合,当主动去调用存储过程时,其中内部的SQL语句会按照逻辑执行。

一:创建存储过程

  

MariaDB [test2]> delimiter //
MariaDB [test2]> create procedure p1() #创建存储过程
    -> begin select * from a;
    -> end //
Query OK, 0 rows affected (0.00 sec)

MariaDB [test2]> call p1()            #调用存储过程
    -> ;
    -> //
+------+
| name |
+------+
|    1 |
|    2 |
|    3 |
|    4 |
+------+
4 rows in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

MariaDB [test2]> 

 

数据库-mysql储存过程

标签:iad   pre   0 rows   maria   adb   create   log   数据   数据库   

原文地址:http://www.cnblogs.com/lixiang1013/p/7294207.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!