?
Solved

ORACLE DBMS JOB

Posted on 2001-06-26
9
Medium Priority
?
1,601 Views
Last Modified: 2012-05-04
This is with regards to the DBMS_JOB utility in ORACLE. I need to run a job at 10:00 AM on all days. The problem is that iam not able to specify the exact date as such. I can either set the next date to some currentdate+x number of hours/monutes/seconds. But ia not able to psefcify the exact date.

Let us assume that i need to run a job on
02-jan-2001 10:00AM  and my current system date is 01-jan-2001 18:00PM

My DBMS_JOB statement would like :

dbms_job.submit(:jnum,'xxx;',sysdate,'sysdate+(16/24)');

But say if i run this job at 20:00 Hrs on 01-jan-2001 the next date time will go further to 14:00 Hrs on 02-jan-2001.
How do i specify the exact time ?

Help me out

Very URGENT
0
Comment
Question by:vish_mp
[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
9 Comments
 
LVL 4

Expert Comment

by:fva
ID: 6226685
dbms_job.submit(:jnum,'xxx;','sysdate','trunc(sysdate)+10/24+1');
It worked for me.

Good luck,
F.
0
 
LVL 2

Expert Comment

by:renuraj
ID: 6226926
DBMS_JOB.SUBMIT (
   :job_no,
   <procedure_name>,
   sysdate,
   trunc(sysdate) + 10/24 + 1);

This will ensure the job ':job_no' to run everyday at 10:00 am.

Regards,
0
 
LVL 4

Expert Comment

by:fva
ID: 6226974
Well, renuraj, good comment, but you missed the quotes :) (both global " and local ' )

F.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
racher earned 600 total points
ID: 6227008
-- this will submit the job for 10:00 tomorrow and will
-- rerun at 10:00 there after
DECLARE
  n_job_number     NUMBER;
BEGIN
  DBMS_JOB.SUBMIT(
    n_job_number
   ,'dp_package_name.procedure_name;'
   ,TO_DATE(TRUNC(SYSDATE+1)||' 10:00','dd-MON-yy hh24:mi')
   ,'TRUNC(SYSDATE+1) + 10/24'
   );
END;
/


0
 
LVL 4

Expert Comment

by:fva
ID: 6227042
Hi racher, welcome to ExEx.

The guidelines on comments and answers below and the ExEx-tiquette would have suggested that posting such an answer is not very appropriate. I agree that your proposed answer will work, but it's not that novel compared to the approaches proposed above to qualify for an answer (at least not according to what I've seen until now in ExEx Oracle thread).

Yours,
F.
0
 
LVL 2

Expert Comment

by:racher
ID: 6227195
My mistake
0
 
LVL 4

Expert Comment

by:fva
ID: 6227550
As I said,

Welcome to ExEx.

Hope you'll be soon in top :)

F.
0
 

Author Comment

by:vish_mp
ID: 6236788
The solution given by racher sounds good but i had used the simpler one given by renuraj.

Thanks a lot
0
 
LVL 4

Expert Comment

by:fva
ID: 6237737
Hey, vish, my suggestion came within 8 minutes only after your request. You said it's URGENT, but you waited for renuraj's proposal (which is missing the same number of quotes as mine, BTW :) ). Your choice.
But why did you grade with B racher's solution if that was your choice?
Just wandering, 'cause it's still your choice. I don't even expect an answer.

Maybe you'll want to take a look at the recommendations about grading. racher's proposal works OK, solves the problem and contains the actual sample piece of code to solve it. What would a questioner want more? Why "punish" him with a B grade?

Yours,
F.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

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…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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 video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Suggested Courses

800 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