Solved

Submitting dbms_job

Posted on 2014-01-30
5
396 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
  • 3
5 Comments
 
LVL 76

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 73

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

785 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