Oarcle 10g JOB

建一张测试表:

CREATE TABLE t_10g_job(
       f_date DATE
);

 

建立一个存储过程:

CREATE OR REPLACE PROCEDURE p_10g_job
AS
BEGIN
INSERT INTO t_10g_job VALUES(SYSDATE);
END;

 

构建JOB:

BEGIN
DBMS_SCHEDULER.CREATE_JOB(
    JOB_NAME => 'JOB10g',--job name
    JOB_TYPE => 'STORED_PROCEDURE',-- JOB TYPE
    JOB_ACTION => 'p_10g_job',-- PROCEDURE EXECUTED BY THE JOB
    START_DATE => SYSDATE, -- JOB START TO EXECUTE DATE
    REPEAT_INTERVAL => 'FREQ=MINUTELY',-- FREQUENCE OF EXECUTING THE JOB
    END_DATE => NULL,-- END DATE OF THE JOB
    ENABLED => TRUE,
    AUTO_DROP =>FALSE,
    COMMENTS =>'Test 10g JOB'-- DESCRIPTION OF THE JOB
);
END;

 

-- RUN THE JOB
BEGIN
DBMS_SCHEDULER.ENABLE('JOB10g');
END;

SELECT * FROM DBA_JOBS
-- STOP THE JOB
BEGIN
DBMS_SCHEDULER.STOP_JOB('JOB10g');
END; 

-- REMOVE THE JOB
BEGIN
DBMS_SCHEDULER.DROP_JOB('JOB10g'); 
END;

 

你可能感兴趣的:(Oracle 10g job)