1

I have an procedure inside a package which i have to run everyday manualy. how to make it done by oracle automaticaly in oracle 10g.

There are 3 inputs(2 nos,1 varchar) and one output(varchar) of the executing procedure

Inputs values will remain same for me,but in case i have to change it wat do I do. can anybody explain me with easy examples.

Thanks Avi

Avi
  • 1,115
  • 8
  • 20
  • 30
  • Dup of http://stackoverflow.com/questions/10538406/creating-a-job-in-oracle-using-dbms-job. See also http://stackoverflow.com/questions/4152111/dbms-job-vs-dbms-scheduler. – Vadzim Oct 15 '14 at 10:12

2 Answers2

2

Take a look at dbms_job package. Its easy to use and does what you need.

Nagh
  • 1,757
  • 1
  • 14
  • 19
1

You can use DBMS_JOB.iSubmit function like the following.

BEGIN 
DBMS_JOB.isubmit ( job => 61, 
                   what => 'YOUR_PROCEDURE;', 
                   next_date => to_date('03.10.2014 00:30:00','dd.MM.yyyy HH24:Mi:ss'), -- start now         INTERVAL => 'sysdate + 1' -- Run every day ); 
COMMIT; 
END;

JOB: You can use an ID which has not been used in user_jobs. You can check them with the following query.

select * from user_jobs; 

What: The name of your procedure with ";" at the end. Next_date: The time you want your job to be run. Interval: The period of your job. Should be 'sysdate+1' for everyday.

You can remove it with the script below:

begin DBMS_JOB.REMOVE(JOB => 61); end;
Lorenz Meyer
  • 19,166
  • 22
  • 75
  • 121
Ocean's61
  • 11
  • 1