Why does EDS timestampdiff and SQL_TSI_MONTH return an integer value?

Solution Verified - Updated -

Issue

  • I need to find out the number of months between 2 dates, and also identify when there is an exact number of months between 2 dates. For example:
1-Jan-2012 -> 1-Mar-2012 = exactly 2 months
1-Jan-2012 -> 2-Mar-2012 > 2 months but less than 3 months

In oracle I can use the months_between function that gives me decimal number showing the number of months between 2 dates:

1-Jan-2012 -> 1-Mar-2012 = 2
1-Jan-2012 -> 2-Mar-2012 = 2.03225806451613

The equivalent function in EDS seems to be timestampdiff passing in SQL_TSI_MONTH:

select timestampdiff(SQL_TSI_MONTH,convert('2012-01-01', date),convert('2012-03-01',date))

The problem with this is, according to your documentation, it will always return an Integer. Is this correct as it seems very strange to me that you don't return a decimal.

Environment

  • JBoss Enterprise Data Services (EDS) 5.3.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.