Execute a job daily at some specific time

rem Name:    daily.sql
rem Purpose: Execute a job daily at some specific time
rem Usage:   @daily <time> "<job>"
rem Subject: job
rem Attrib:  sql
rem SeeAlso: @jc @jobs @submit

@setup

define tim="&&1"
define cmd="'&&2'"

declare
  i number;
  d date;
begin
  d := trunc(sysdate)+&&tim/24;
  if d <= sysdate then
    d := d + 1;
  end if;
  sys.dbms_job.submit(i, &&cmd, d, 'trunc(sysdate+1)+&&tim/24');
  &&putl('Job '||i||' submitted (commit required).');
end;
/

undef tim cmd

@setdefs

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.