2

I am trying to schedule a stored procedure in Oracle, it should run daily at a certain time, for example at 11:59 pm

 BEGIN
 DBMS_SCHEDULER.CREATE_JOB (
 job_name           =>  'BLANKET_WO',
 job_type           =>  'STORED_PROCEDURE',
 job_action         =>  'AAKPID.BLANKET_WO_PROC',
 repeat_interval    =>  'FREQ=DAILY;BYHOUR=23;BYMINUTE=59');
 END;
 /

Will this code work?

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
Ameya
  • 78
  • 1
  • 11

1 Answers1

2

Try this, it should work:

 BEGIN
 DBMS_SCHEDULER.CREATE_JOB (
 job_name           =>  'BLANKET_WO',
 job_type           =>  'STORED_PROCEDURE',
 job_action         =>  'AAKPID.BLANKET_WO_PROC',
 start_date         =>  '16-nov-2017 11:50:00 pm',
 repeat_interval    =>  'FREQ=DAILY;BYHOUR=23;BYMINUTE=59',
 enabled            =>  true
);
 END;
 /
Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
  • Will this run on 59 th minute ? – Ameya Nov 16 '17 at 09:34
  • @AmeyaLokhande yes, you may try for a near future with respect to your local time. – Barbaros Özhan Nov 16 '17 at 09:38
  • Note: there's no need to specify `start_date` unless you want to delay it for some reason - the default behaviour is to start as soon as the job is enabled. Also, `start_date` is not a string parameter (it's a `timestamp with time zone`) so relying on implicit conversion from a string is less than ideal. – Jeffrey Kemp Nov 17 '17 at 03:05