Solved

Submitting dbms_job

Posted on 2014-01-30
5
389 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.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Oracle SQL Select Statement 19 58
Out of Sequence numbers for today 25 47
oracle query help 29 64
query in Oracle forms Builder 2 27
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now