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

mysql存储过程简单使用

时间:2014-08-29 12:42:07      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   ar   数据   div   log   sp   

1、创建存储过程

BEGIN

CREATE TEMPORARY TABLE `tmp_table` ( 

    `name` VARCHAR(100) NOT NULL, 

    `value` VARCHAR(100) NOT NULL 

);

insert into `tmp_table` select `userName` as `name`,`realName` as `value` from `userinfo` where `isDeleted`=0 limit 10;

update `tmp_table` set `name`=test,`value`=测试数据;

select * from `tmp_table`;

drop table `tmp_table`;

END

2、执行存储过程

CALL pro_test;

 

mysql存储过程简单使用

标签:style   blog   color   使用   ar   数据   div   log   sp   

原文地址:http://www.cnblogs.com/MrLenon/p/3944593.html

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