Using dbms_scheduler to run a program

I am trying to run a program using scheduler job.My code goes as follows:

--Program
BEGIN
  dbms_scheduler.create_program (
    program_name    =>  'firstprogram',
    program_type    =>  'PLSQL_BLOCK',
    program_action  =>  'BEGIN Execute immediate ''Create table xyz(id int, name varchar2(10))''; end;',
    enabled         =>  TRUE,
    comments        =>  'First program');

END;
/
--Schedule
BEGIN
  DBMS_SCHEDULER.create_schedule (
    schedule_name   => 'firstschedule',
    start_date      => SYSTIMESTAMP,
    repeat_interval => 'freq=daily; byhour=14; byminute=25',
    end_date        => NULL,
    comments        => 'Repeats daily');
END;
/
--Job
BEGIN
  dbms_scheduler.create_job (
    job_name      =>  'firstjob',
    program_name  =>  'firstprogram',
    schedule_name =>  'firstschedule',
    enabled       =>  TRUE,
    comments      =>  'Use firstprogram and FirstSchedule');
END;
/

All these code blocks compile without showing any errors. But the table xyz is not created in the specified time. Can anyone explain me why? I am using Oracle.


Source: oracle

Leave a Reply