Comparing Dates in Oracle Business Rule Decision Tables

Posted by James Taylor on Oracle Blogs See other posts from Oracle Blogs or by James Taylor
Published on Thu, 30 Aug 2012 10:54:54 +0000 Indexed on 2012/08/30 15:44 UTC
Read the original article Hit count: 290

I have been working with decision tables for some time but have never had a scenario where I need to compare dates. The use case was to check if a persons membership had expired. I didn't think much of it till I started to develop it. The first trap I feel into was trying to create ranges and bucket sets. The other trap I fell into was not converting the date field to a complete date. This may seem obvious to most people but my Google searches came up with nothing so I thought I would create a quick post.

I assume everyone knows how to create a decision table so I'm not going to go through those steps. The prerequisite for this post is to have a decision table with a payload that has a date field. This filed must have the date in the following format YYYY-MM-DDThh:mm:ss.

  1. Create a new condition in your decision table
  2. Right-click on the condition to edit it and select the expression builder



  3. In the expression builder, select the Functions tab.
  4. Expand the CurrentDate file and select date, and click Insert Into Expression button.



  5. In the Expression Builder you need to create an expression that will return true or false, add the operation <= after the CurrentDate.date



  6. In my scenario my date field is memberExpire, Navigate to your date field and expand, select toGregorianCalendar().



  7. Your expression will look something like this, click OK to get back to the decision table



  8. Now its just a matter of checking if the value is true or false.

Simple when you know how :-)


© Oracle Blogs or respective owner

Related posts about /Oracle/Business Rules