7.job.sql 975 B

1234567891011121314151617181920212223242526
  1. --许可证延续状态更新job
  2. create or replace procedure updateXkz as
  3. begin
  4. update GK_SHARE_JSJY_JYXKZ set sfyx = 2 where to_char(yxqz,'yyyy-mm-dd') = to_char(sysdate,'yyyy-mm-dd') and record_status <> 9 and sfyx =1;
  5. update GK_SHARE_JSJY_JYXKZ set sfyx = 1 where to_char(yxqz,'yyyy-mm-dd') = to_char(sysdate+interval '3' year,'yyyy-mm-dd') and record_status <> 9 and sfyx = 4 ;
  6. update GK_SHARE_JSJY_JYXKZ set sfyx=2 where record_status <> 9 and sfyx = 1 and to_char(sysdate,'yyyy-mm-dd') >to_char(yxqz,'yyyy-mm-dd');
  7. commit;
  8. end updateXkz;
  9. --定时任务,运行时根据时间实际时间更新to_date时间
  10. variable job number;
  11. begin
  12. sys.dbms_job.submit(job => :job,
  13. what => 'updateXkz;',
  14. next_date => to_date('20-07-2016 23:59:59', 'dd-mm-yyyy hh24:mi:ss'),
  15. interval => 'sysdate+1/24/60');
  16. commit;
  17. end;
  18. update gk_operation_jsjy_xkzsqglb set record_status = 1;