Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Oracle's months_between -function

1 view
Skip to first unread message

eh

unread,
Feb 1, 2010, 8:39:05 AM2/1/10
to
Hi,
is there an obviuos explanation to this case; months_between -function
seems to act a little weird with time given:
===========
select months_between(to_date('02.02.2010','dd.mm.yyyy'),to_date
('01.02.2010', 'dd.mm.yyyy'))
from dual
---> 0.0322
===========
... and then we add times to the mask
===========
select months_between(to_date('02.02.2010 00:00:01','dd.mm.yyyy
hh24:mi:ss'),to_date('01.02.2010 23:59:59', 'dd.mm.yyyy hh24:mi:ss'))
from dual
---> 7,467
===========
How about that ???
is it so simple that do not use time-format with monts_between .???
BR,
timo

Thomas Olszewicki

unread,
Feb 1, 2010, 9:30:05 AM2/1/10
to

You are missing part of the display:
It is : 7.46714456391876E-7
So IMHO looks ok.
Thomas

Kay Kanekowski

unread,
Feb 1, 2010, 9:47:39 AM2/1/10
to
Hi Timo,
as Thomas stated, it looks ok.
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/functions089.htm

But as you can read here
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:53374949268527

" ... problem is "months" are NOT a fixed unit of time. ..."

regards
Kay

Shakespeare

unread,
Feb 2, 2010, 3:03:05 AM2/2/10
to
Op 1-2-2010 14:39, eh schreef:

Did you notice that the first calculation is 1 day, the latter 2
seconds? And like Thomas stated: you're missing a part of your result
because your column width is to small.

Shakespeare

0 new messages