我有一個Oracle For循環,它創建n個作業。 對於創建的每個作業,開始日期與以前的作業間隔爲10秒。 但由於某種原因,每項工作都在1秒內發起。 Oracle在未來的工作是不可能的嗎?Oracle Job根據開始日期參數不起始
LTIMESTAMP := SYSTIMESTAMP;
FOR REC IN (SELECT *
FROM ORDERS
WHERE PROCESS_FLAG = CST_IS_ELIGIBLE_FOR_PROCESSING
ORDER BY ORDER_DATE ASC)
LOOP
LJOBNAME := CST_JOB_NAME_PREFIX || TO_CHAR(REC.ORDER_ID);
DBMS_SCHEDULER.CREATE_PROGRAM(PROGRAM_NAME => CST_PROGRAM_NAME,
PROGRAM_ACTION => 'PKG_BATCH_MAIN.SP_START_JOB',
PROGRAM_TYPE => 'STORED_PROCEDURE',
NUMBER_OF_ARGUMENTS => 2,
ENABLED => FALSE);
DBMS_SCHEDULER.DEFINE_PROGRAM_ARGUMENT(PROGRAM_NAME => CST_PROGRAM_NAME,
ARGUMENT_POSITION => 1,
ARGUMENT_TYPE => 'NUMBER');
DBMS_SCHEDULER.DEFINE_PROGRAM_ARGUMENT(PROGRAM_NAME => CST_PROGRAM_NAME,
ARGUMENT_POSITION => 2,
ARGUMENT_TYPE => 'NUMBER');
DBMS_SCHEDULER.ENABLE(CST_PROGRAM_NAME);
DBMS_SCHEDULER.CREATE_JOB(JOB_NAME => LJOBNAME,
PROGRAM_NAME => CST_PROGRAM_NAME,
START_DATE => LTIMESTAMP,
REPEAT_INTERVAL => 'FREQ=SECONDLY; BYSECOND=1',
END_DATE => NULL,
AUTO_DROP => TRUE,
ENABLED => FALSE,
COMMENTS => 'Job launched for each ORDER detail id');
DBMS_SCHEDULER.SET_ATTRIBUTE(LJOBNAME,
'MAX_RUNS',
1);
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE(LJOBNAME,
1,
TO_CHAR(REC.ORDER_ID));
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE(LJOBNAME,
2,
TO_CHAR(REC.ORDER_DETAILS_ID));
DBMS_SCHEDULER.ENABLE(LJOBNAME);
LTIMESTAMP := LTIMESTAMP + INTERVAL '10' SECOND;
END LOOP;
你能告訴我們你寫的代碼嗎? – Nitish
對於其中一些工作,您可以給我們'DBA_SCHEDULER_JOB_RUN_DETAILS'的LOG_DATE,REQ_START_DATE,ACTUAL_START_DATE,RUN_DURATION嗎? – JSapkota