博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
例子:发送短信(存储过程)
阅读量:5030 次
发布时间:2019-06-12

本文共 1526 字,大约阅读时间需要 5 分钟。

 
  1. BEGIN
  2. DECLARE Done INT DEFAULT 0;
  3. DECLARE exdate datetime;
  4. DECLARE textdata text;
  5. DECLARE m_time datetime;
  6. DECLARE b_num varchar(20);
  7. DECLARE telwq varchar(20);
  8. DECLARE telhb varchar(20);
  9. DECLARE telsj varchar(20);
  10. DECLARE cc int;
  11. DECLARE rs CURSOR FOR SELECT
  12. a.F25 AS b_num,
  13. b.F11 AS m_time
  14. FROM S62.T6230 AS a,S62.T6231 as b
  15. WHERE a.F01=b.F01 AND b.F11 BETWEEN DATE_SUB(NOW(),INTERVAL 30 minute) AND NOW();
  16. DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET Done = 1;
  17. SET telwq=13760836670;
  18. SET telhb=15920149039;
  19. SET telsj=13808870034;
  20. SET exdate = (SELECT DATE_ADD(NOW(),INTERVAL 30 minute));
  21. IF (SELECT COUNT(a.F01) FROM S62.T6230 AS a,S62.T6231 as b WHERE a.F01=b.F01 AND b.F11 BETWEEN DATE_SUB(NOW(),INTERVAL 30 minute) AND NOW()) > 0
  22. THEN
  23. OPEN rs;
  24. FETCH NEXT FROM rs INTO b_num,m_time;
  25. REPEAT
  26. SET textdata = (SELECT CONCAT('标编号为"',b_num,'"的标已于"',m_time,'"满标,请登录后台进行放款操作。'));
  27. -- WQ
  28. INSERT INTO
  29. S10._1040 (F02,F03,F04,F05,F06)
  30. VALUES (0,textdata,NOW(),'W',exdate);
  31. SET cc =(SELECT @@IDENTITY);
  32. INSERT INTO
  33. S10._1041 (F01,F02)
  34. VALUES (cc,telwq);
  35. -- HB
  36. INSERT INTO
  37. S10._1040 (F02,F03,F04,F05,F06)
  38. VALUES (0,textdata,NOW(),'W',exdate);
  39. SET cc =(SELECT @@IDENTITY);
  40. INSERT INTO
  41. S10._1041 (F01,F02)
  42. VALUES (cc,telhb);
  43. -- SJ
  44. INSERT INTO
  45. S10._1040 (F02,F03,F04,F05,F06)
  46. VALUES (0,textdata,NOW(),'W',exdate);
  47. SET cc =(SELECT @@IDENTITY);
  48. INSERT INTO
  49. S10._1041 (F01,F02)
  50. VALUES (cc,telsj);
  51. FETCH NEXT FROM rs INTO b_num,m_time;
  52. UNTIL Done END REPEAT;
  53. CLOSE rs;
  54. END IF;
  55. END

转载于:https://www.cnblogs.com/tangbinghaochi/p/6292962.html

你可能感兴趣的文章
【JavaScript】Write和Writeln的区别
查看>>
百度编辑器图片在线流量返回url改动
查看>>
我对你的期望有点过了
查看>>
微信小程序wx:key以及wx:key=" *this"详解:
查看>>
下拉框比较符
查看>>
2.2.5 因子的使用
查看>>
css选择器
查看>>
photoplus
查看>>
Python 拓展之推导式
查看>>
[Leetcode] DP-- 474. Ones and Zeroes
查看>>
80X86寄存器详解<转载>
查看>>
c# aop讲解
查看>>
iterable与iterator
查看>>
返回顶部(动画)
查看>>
webpack+react+antd 单页面应用实例
查看>>
Confluence 6 SQL Server 数据库驱动修改
查看>>
Confluence 6 通过 SSL 或 HTTPS 运行 - 备注和问题解决
查看>>
【47.76%】【Round #380B】Spotlights
查看>>
Git(使用码云)
查看>>
分享Java web 开发必游之路
查看>>