Reputation: 59
i have to schedule a stored procedure in oracle 10g?
assume
create table t1(name varchar2(10));
insert into t1 values('hi');
create or replace procedure insertname
as
begin
insert into t1 values('hi');
end;
now my requirement is everday at 11 am my procedure has to be executed automatically.
how can i implement it.
actually i studied about dbms_scheduler.create_job. but i am not able to implement it can any body explain me how can i schedule my stored procedure.
thanks in advance
Upvotes: 3
Views: 12028
Reputation: 3202
Have a look here: http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_sched.htm
or with way better examples: http://www.apex-at-work.com/2009/06/dbmsscheduler-examples.html
The interesting part for you (simply change the job_action)
dbms_scheduler.create_job (
job_name => 'TEST_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'begin /* some process code */ commit; end;',
number_of_arguments => 0,
start_date => sysdate +1/24/59, -- sysdate + 1 minute
job_class => 'ADMIN', -- Priority Group
enabled => TRUE,
auto_drop => TRUE,
comments => 'Testrun');
Upvotes: 1