源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

MySQL实现创建存储过程并循环添加记录的方法

  • 时间:2020-05-01 15:05 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:MySQL实现创建存储过程并循环添加记录的方法
本文实例讲述了MySQL实现创建存储过程并循环添加记录的方法。分享给大家供大家参考,具体如下: 先创建,然后调用:
-- 创建存储过程
DELIMITER;//
create procedure myproc()
begin
declare num int;
set num=1;
while num <= 24 do
insert into t_calendar_hour(hourlist) values(num);
set num=num+1;
end while;
commit;
end;//
-- 调用存储过程
CALL myproc();

[b]PS:这里再为大家推荐2款常用的sql在线工具供大家参考使用(包含SQL语句用法说明):[/b] [b]SQL在线压缩/格式化工具: [/b][url=http://tools.jb51.net/code/sql_format_compress]http://tools.jb51.net/code/sql_format_compress[/url] [b]SQL代码在线格式化美化工具: [/b][url=http://tools.jb51.net/code/sqlcodeformat]http://tools.jb51.net/code/sqlcodeformat[/url] 更多关于MySQL相关内容感兴趣的读者可查看本站专题:《[url=http://www.1sucai.cn/Special/563.htm]MySQL存储过程技巧大全[/url]》、《[url=http://www.1sucai.cn/Special/606.htm]MySQL常用函数大汇总[/url]》、《[url=http://www.1sucai.cn/Special/594.htm]MySQL日志操作技巧大全[/url]》、《[url=http://www.1sucai.cn/Special/441.htm]MySQL事务操作技巧汇总[/url]》及《[url=http://www.1sucai.cn/Special/568.htm]MySQL数据库锁相关技巧汇总[/url]》 希望本文所述对大家MySQL数据库计有所帮助。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部