个人随笔
目录
一个简单定时器,每30分钟执行一次
2025-06-05 10:24:29

我们创建一个定时器,需要先创建一个存储过程,创建完存储过程后,再创建定时器,不能同时执行。

1、创建存储过程

  1. create or replace procedure tenant_job is
  2. begin
  3. insert into t_gd_hd_sys_tenant_act (id,activity_code,user_id,tenant_id,create_datetime,update_datetime)
  4. select t.activity_code,t.activity_code,t.create_tlr_id,'1',t.create_datetime,t.update_datetime from t_gd_wx_activity_info t where t.activity_code not in(select activity_code from t_gd_hd_sys_tenant_act)
  5. and t.create_tlr_id is not null and length(t.create_tlr_id)>15 and t.activity_class='1103';
  6. end;

2、创建定时器

  1. declare
  2. job number;
  3. begin
  4. dbms_job.submit(
  5. job,
  6. 'tenant_job;',
  7. sysdate,
  8. 'TRUNC(sysdate,''mi'') + 30/(24*60)'
  9. );
  10. commit;
  11. end;

上面的定时器,mi是分钟,记得用四个单引号括起来,可以改为hh小时,那么后面的就改为(24)而不是(24*60)

 7

啊!这个可能是世界上最丑的留言输入框功能~


当然,也是最丑的留言列表

有疑问发邮件到 : suibibk@qq.com 侵权立删
Copyright : 个人随笔   备案号 : 粤ICP备18099399号-2