Home » SQL & PL/SQL » SQL & PL/SQL » Select Day of the Week
Select Day of the Week [message #221884] Wed, 28 February 2007 15:16 Go to next message
faiz_hyd
Messages: 294
Registered: February 2006
Senior Member
Hi,

I am submitting this as a DBMS_JOB
how can i give here the next date to run this job as coming saturday 12:00:00 AM and
interval to be every saturday 12:00:00 AM

DECLARE
  X NUMBER;
BEGIN
  SYS.DBMS_JOB.SUBMIT
    ( job       => X 
     ,what      => '/* job_name: JOB_DAILY_GATHER_STATS */BEGIN dbms_stats.gather_schema_stats(ownname => ''APP'', estimate_percent => NULL, cascade => TRUE); END;'
     ,next_date => ---NEXT SATURDAY 12.00:00 AM
     ,interval  => every Saturday
     ,no_parse  => TRUE
    );
  SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
END;
commit;
/

Thanks
Re: Select Day of the Week [message #221890 is a reply to message #221884] Wed, 28 February 2007 16:37 Go to previous messageGo to next message
Littlefoot
Messages: 20896
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Perhaps this might be what you are looking for:
next_date => TRUNC(SYSDATE, 'ww') + 5 + 12/24
interval  => 'SYSDATE + 7'
Re: Select Day of the Week [message #221897 is a reply to message #221890] Wed, 28 February 2007 21:58 Go to previous messageGo to next message
faiz_hyd
Messages: 294
Registered: February 2006
Senior Member
Thanks for followup,

> next_date => TRUNC(SYSDATE, 'ww') + 5 + 12/24
--- This is giving 12 PM, and i am looking to run at 12:a.m

> interval => 'SYSDATE + 7' will sysdate +7
will this format get all saturday's in FEB and then follow to next month also.


Thanks
Re: Select Day of the Week [message #221914 is a reply to message #221884] Thu, 01 March 2007 00:58 Go to previous message
friendarora
Messages: 24
Registered: February 2007
Junior Member

Hi

as per your requirement u can try this:

> next_date => TRUNC(SYSDATE, 'ww') + 5
---this will give you 12:00 AM

> interval => 'trunc(SYSDATE,'ww')+ 5 + 7'
-- 'trunc(SYSDATE,'ww')+ 5' this will return Saturday
and subsequently every 7th day after that will also be saturday


Nitin
Previous Topic: Problems with PIVOT type query
Next Topic: ORA-29279:SMTP permanent error:553 sorry , that domain isn,t in my list of allowed rcpthosts
Goto Forum:
  


Current Time: Tue Dec 06 02:20:07 CST 2016

Total time taken to generate the page: 0.14295 seconds