Saturday, 8 June 2013

oracle date arithmetic returning unexpectedly large number

oracle date arithmetic returning unexpectedly large number

I have a question regarding the way that oracle does arithmetic on dates (connecting to 10g database). Given the following query:
select DateX - DateY as Number_Of_Days from table
my experience has led me to believe that oracle would return the number of days difference between the two dates (if DateX was earlier than DateY a negative # of days would be returned).
For most records being returned by my query, this is true. However, I have a single record in my dataset where DateX = 19-JUN-08 and DateY = 19-MAY-08 and the subtraction of those two = 365268.
Any ideas?

No comments:

Post a Comment