Trying to create job But can't compile it keeps me given this error. There is a question on oracle forums, it say's that i have to create program to wrap it. Is there any workaround for this?
-- Created on 30.09.2014 by ALI.ORHAN
declare
-- Local variables here
i integer;
begin
-- Test statements here
dbms_scheduler.create_job(job_name => 'blabla'
,job_type => 'STORED_PROCEDURE'
,job_action => 'dingdongprocedure;'
,start_date => '30-OCT-14 10.00.00 PM'
,end_date => '15-JULY-08'
,repeat_interval => 'FREQ=WEEKLY BYDAY=TUE,FRI BYHOUR=10,13'
,enable => 'TRUE'
,comments => 'SUPREME COMMENT');
end;
After i created job from PL/SQL Developer UI, i found out my syntax erorrs, new code is below;
- i use sys.dbms_scheduler.create_job instead of dbms_scheduler.create_job. I don't know differances but it's not important alteration.
- i used to_date to define start_date, as a fresh-starter i found this better practise.
Important I added job_class parameter to 'DBMS_JOB$'. DBMS_JOB is built_in job class of Oracle RDBMS. So you find all jobs with this query:
select * from ALL_SCHEDULER_JOBS WHERE JOB_CLASS='DBMS_JOB$'
Important My interval's were wrong you should put ; between all parameters like
repeat_interval => freq=weekly;byhour=10, 13
- My first job code has another syntax error i use enable instead of enabled.
I set auto_drop false. I guess this parameter is used to drop job when it dones his job. I mean if you create a job that makes changes daily from today to next week. After end-time reaches, this job has dropped. Please correct me if i wrong.
sys.dbms_scheduler.create_job(job_name => 'BOMBASTICJOB' ,job_type => 'STORED_PROCEDURE' ,job_action => 'dingdongprocedure' ,start_date => to_date('30-09-2014 00:00:00' , 'dd-mm-yyyy hh24:mi:ss') ,end_date => to_date(null) ,job_class => 'DBMS_JOB$' ,repeat_interval => 'Freq=Weekly; ByDay=Tue, Fri; ByHour=10, 13' ,enabled => true ,auto_drop => false ,comments => '');
I am on 12.1.0.1.0. You could create the job in a simple anonymous block :
More examples here