Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Convert repeat_interval from DBMS scheduler to a usable datatype

Reply
Thread Tools

Convert repeat_interval from DBMS scheduler to a usable datatype

 
 
Wask8N Wask8N is offline
Junior Member
Join Date: Sep 2011
Posts: 2
 
      09-21-2011
Making a custom job scheduler that pulls job from our oracle DB and I would like to be able to convert a repeat_interval format into something I can use to test against job start times so the app knows when to run the next job.

So far the logic I have pulls the next_start_time field and adds the converted repeat_interval to next_start_time then I test against the current time.

ex:

next_start_time = 9/20/2011 11:50:00.000000 AM -05:00
repeat_interval = FREQ=DAILY;BYHOUR=13;BYMINUTE=30;

public void ConvertInterval()
{
split repeat_interval
insert into TimeSpan
return ConvertedToTimespan
}

next_start_time.add(ConvertedToTimespan)

If (next_start_time <= DateTime.Now)
{ run job }

I split by ; and extract each part then split again by = to extract the numbers. I have 2 different splits because there's a lot of case statements differenciating the Frequency values. Then add them into a time span, and just add that time span to the next_start_time. The thing is that logic does not work.

There's a lot of different match ups for interval values so it makes it a lot harder. I attached a picture of what values and match ups will be used. Does anyone have any other logic or ideas to throw at me, I'm super stumped? Thanks

DBMS Scheduler: http://download.oracle.com/docs/cd/B...58/d_sched.htm
Attached Images
File Type: jpg repeatinterval.JPG (29.5 KB, 2 views)
 
Reply With Quote
 
 
 
 
Wask8N Wask8N is offline
Junior Member
Join Date: Sep 2011
Posts: 2
 
      10-05-2011
Might as well answer my own question since this post has 50 views or so.

Found out through a peer there is a function in oracle that converts repeat_intervals to dates.

CREATEORREPLACEFUNCTION SUPPORT_SERVICES.CMN_DBMS_REPEAT_INTERVAL_TO_DT(
p_repeat_interval_str INVARCHAR2:=NULL,
p_start_date INTIMESTAMPWITHTIMEZONE:=NULL,
p_return_date_after INTIMESTAMPWITHTIMEZONE:=NULL
)
RETURNTIMESTAMPWITHTIMEZONE
IS
dte TIMESTAMP(6)WITHTIMEZONE;

BEGIN
dte :=NULL;
DBMS_SCHEDULER.EVALUATE_CALENDAR_STRING(p_repeat_interval_str, p_start_date, p_return_date_after, dte);
RETURN dte;
ENDCMN_DBMS_REPEAT_INTERVAL_TO_DT;
/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dotnet scheduler like the Windows "Schedued Tasks" scheduler? Codemonkey ASP .Net 8 06-10-2011 10:53 AM
database datatype bit what is the C# datatype? Jeff ASP .Net 2 04-16-2007 08:26 PM
Seeking for SQL99 pure Java DBMS Maurice LING Java 1 06-30-2004 11:24 PM
Recommended Open Source DBMS for J2EE Steven Woody Java 10 10-23-2003 05:33 PM
Best choice for a free visual programming in Java + DBMS P.DELMAS Java 3 10-01-2003 11:36 AM



Advertisments