Chinaunix首页 | 论坛 | 博客
  • 博客访问: 109028
  • 博文数量: 27
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 360
  • 用 户 组: 普通用户
  • 注册时间: 2013-08-07 00:14
文章分类

全部博文(27)

文章存档

2015年(1)

2014年(20)

2013年(6)

我的朋友

分类: Mysql/postgreSQL

2015-01-15 00:20:49

参考: http://blog.csdn.net/chszs/article/details/5818363

点击(此处)折叠或打开

  1. drop procedure if exists `simpleproc`;

  2. delimiter //
  3. CREATE PROCEDURE `simpleproc`(in tname varchar(128), in days int, out tt datetime)
  4. begin
  5.     set @sqlcmd = concat('select max(start_date_time) into @tmp from ', tname);
  6.     prepare stmt from @sqlcmd;
  7.     execute stmt;
  8.     deallocate prepare stmt;
  9.     set @tmp=date(@tmp);
  10.     set @tmp=date_sub(@tmp, interval days day);
  11.     set tt=timestamp(@tmp);
  12. end//

  13. delimiter ;
  14. call simpleproc('gb_kpi_service', 7, @tt);

阅读(1263) | 评论(0) | 转发(0) |
0

上一篇:Linux 使用xclip剪切板

下一篇:没有了

给主人留下些什么吧!~~