sql - How to run procedure every week till end date in oracle -
i have procedure need execute every week date of deployment in production.it should run on day of deployment , subsequent weeks till end date stored in variable.
i need incorporate @ procedure level rather creating separate scheduler or dbms_job
suppose start date 11/1/2013 (day of deployment) , end date 04/30/2014 need run procedure every week once between period including start date.
suppose proc run on 04/28/2014 , next week falls in may, till 4/30/2014 should run each day.
help appreciated.
begin in (select typename ....)-- give 3 output loop if typename = 'abc' -- run update every week start date end update test set test.a = ...., test.b = .... test.c in (....) elsif typename = 'pqr'then update test1 set test.a1 = ..., test.b1 = ..., test1.c in (....) end loop; end; -- run update every week start date end --note start date , end date different different types. --***if week ran less end date schedule update every day --that week --eg last day ends @ 04/30/2014, , --the last run happened on 04/28/2014 update should run on 4/29,4/30
consider bob jarvis commented, if still need solve problem , 1 possible solution use dbms_lock.sleep( number_of_seconds ); , basic pseudocode :
- run dml statements
- calculate number seconds in week
- use dbms_lock.sleep( number_of_seconds ); suspend procedure
- repeat until end date equal or less sysdate.
see more information procedure in here
Comments
Post a Comment