SELECT SYSDATE - to_date(substr(TIMEKEY,1,14),'yyyy-mm-dd hh24:mi:ss') FROM Z_JOB_RUN_TIME WHERE JOBNAME LIKE 'LoadSpcData_%' AND SYSDATE - min(TIMEKEY) > ORDER BY TIMEKEY DESC --JOBNAME = 'LoadSpcData_OC_P_N_RS[(R|S)]' UPDATETIME>=to_date('2018-12-29 09:00:00','yyyy/mm/dd HH24:MI:SS') SELECT ROUND(to_number(sysdate - to_date(SUBSTR('20190109155459578000',1,14),'yyyy-mm-dd hh24:mi:ss'))*24*60*60) FROM dual SELECT to_date(SUBSTR('20190109155459578000',1,14),'yyyy-mm-dd hh24:mi:ss') FROM dual SELECT SYSDATE FROM dual ROUND(TO_NUMBER(END_DATE - START_DATE) * 24 * 60 * 60) 2019-01-09 16:44:29 2019-01-09 15:54:59 0.0344444444444444444444444444444444444444
实际业务中需要监控timekey和当前时间差距超过一定值时,应该要发alarm,人为介入处理。