• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

mysql中event例证_mysql

mysql 搞代码 7年前 (2018-06-07) 153次浏览 已收录 0个评论

mysql中event例子

 

 mysql中event例子

 

-- Create event ev_test_006 delimiter $$ Create event ev_test_006 on schedule every 35 MINUTE  DO Begin     declare v_di_game_id int;  declare v_di_database varchar(50);  declare m_stop_flag int default 0;  declare cursor_game cursor for  select di_game_id,di_database from t910_database_info;  declare continue handler for not found set m_stop_flag=1;   open cursor_game;        repeat fetch cursor_game into v_di_game_id,v_di_database;      if m_stop_flag=0 then                    -- t_user_remain          set @v_sql=concat("delete from t006_today_data where td_game_id=",v_di_game_id);          prepare stmt from @v_sql;          EXECUTE stmt;          deallocate prepare stmt;                    set @v_sql=concat("insert into t006_today_data(td_game_id,td_server_id,td_platform_id,td_channel_id,td_calc_date,td_user_reg_count,td_user_reg_count_total,td_user_pay_new_count,td_amount,td_amount_total,td_update_time,td_create_time) select ",v_di_game_id,",td_server_id,td_platform_id,td_channel_id,td_calc_date,td_user_reg_count,td_user_reg_count_total,td_user_pay_new_count,td_amount,td_amount_total,td_update_time,date_format(now(),'%Y-%m-%d %H:%i:%s') from ",v_di_database,".t006_today_data where td_calc_date=date_format(now(),'%Y-%m-%d')");          prepare stmt from @v_sql;          EXECUTE stmt;          deallocate prepare stmt;                end if;  until m_stop_flag=1 end repeat;  close cursor_game;  END $$ delimiter ; 

 

 

欢迎大家阅读《mysql中event例证_mysql》,跪求各位点评,by 搞代码


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:mysql中event例证_mysql
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址