Saturday, January 19, 2008

Oracle 10g: DBMS_Scheduler.create_job

/*
How to create a scheduler in Oracle Using PL/SQL.
job_name : A name that been given to a scheduler job
job_action: I have modified the job action so that
it will trigger a Stored Procedure.
Check out the nested code.
repeat_interval: can be changed to hourly, minutely
enabled : make sure to set it to true.
To stop scheduler, set it to false
*/


BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'test_job',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN GBL_ARCHIVE_PCKG.SP_UPDATETRNWORKFLOW; END;',
enabled => true,
start_date => systimestamp,
repeat_interval => 'freq=daily;byhour=23;byminute=0;bysecond=0');
END;
/

No comments: