Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Months_Between flaw?

Months_Between flaw?

From: <tabates_at_my-dejanews.com>
Date: Sat, 03 Apr 1999 00:34:15 GMT
Message-ID: <7e3nm7$daf$1@nnrp1.dejanews.com>


I believe that there is a flaw with the Months_Between function. There are times where I need to select transactions that have occured within the past month (calendar). I was using something akin to: select sum(amount) from transactions
where trunc(months_between(today, processed))=0;

During testing I found that it would include invalid data. The error occurs when today = '28-Feb-99'. Transactions on '1/31/99' will not be included, however, events on 1/29 and 1/30 will. I have since avoided this issue by the using the following: select sum(amount) from transactions
where to_char(processed, 'MM/yyyy') = to_char(today, 'MM/yyyy');

Comments?

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Apr 02 1999 - 18:34:15 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US