Solved

Submitting dbms_job

Posted on 2014-01-30
5
400 Views
Last Modified: 2014-01-31
DECLARE
    x   NUMBER;
BEGIN
    DBMS_JOB.SUBMIT
  ( job       => X
   ,what      => 'wb_donors_elig_for_conv_proc;'
   ,next_date =>  to_date('31-Jan-2014 06:30','dd-Mon-yyyy hh24:mi')
   ,interval  => 'SYSDATE + 1'
   ,no_parse  => FALSE
  );
    COMMIT;
END;

It will start every day at 6.30a.m. Is there a way to exclude sundays? Help appreciated.
0
Comment
Question by:anumoses
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39821404
If you can, use dbms_scheduler instead of dbms_job.  It is much more flexible.

You can create your own function that returns the 'next' day to run and just have it skip Sunday.

A previous question has an example of using a user-defined function with dbms_job:
http://www.experts-exchange.com/Database/Oracle/Q_24518466.html


>>It will start every day at 6.30a.m.

Note:  Not specifying the EXACT time and using something like sysdate+1 will cause time drift.  It will not be exactly 'tomorrow' at 6:30 AM.

Set up a simple job that does nothing but insert sysdate into a table and test it...
0
 
LVL 6

Author Comment

by:anumoses
ID: 39821425
With oracle version 9 , I cannot use scheduler.
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 250 total points
ID: 39821481
try using this for your interval, this will skip Sundays and eliminates the schedule drift mentioned above


interval => 'TRUNC(CASE WHEN TO_CHAR(SYSDATE, ''Dy'') = ''Sat'' THEN SYSDATE + 1 ELSE SYSDATE END) + 1 + 6.5 / 24'
0
 
LVL 6

Author Comment

by:anumoses
ID: 39821516
Thanks a lot.
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39824016
thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question