A recent use of a telecommunications project JOB, write this summary for future needs.
Create a stored procedure and execute JOB, the following code:
CREATE OR REPLACE PROCEDURE P_TEST_JOB IS -- Determine whether the task has been created, if a task is created , The isExist > 0 isExist NUMBER := 0; -- Archiving task ID jobId NUMBER; BEGIN SELECT COUNT(*) INTO isExist FROM ALL_JOBS J WHERE J.WHAT = ' Procedure name ;'; -- Check whether the task has been created, if you have been created , You do not do action IF isExist = 0 THEN -- Created task DBMS_JOB.submit(jobId, -- Task ID ' Procedure name ;', -- Task to execute a stored procedure, after the semicolon is not available SYSDATE, -- Job start time 'SYSDATE + 10/1440'); -- Task implementation cycle, in this case, each 10 Minutes to perform a COMMIT; -- To run the task DBMS_JOB.run(jobId); COMMIT; END IF; END;
Execute this stored procedure in ORACLE to run the JOB list will appear in the new JOB, you can use
SELECT * FROM ALL_JOBS J WHERE J.WHAT = ' Procedure name ;'
JOB you just created to see the implementation.