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

Home -> Community -> Usenet -> c.d.o.misc -> Re: months_between function

Re: months_between function

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 12 Nov 1998 19:10:03 GMT
Message-ID: <36553256.20673977@192.86.155.100>


A copy of this was sent to "Eric St-pierre" <ericst_at_mediom.qc.ca> (if that email address didn't require changing) On Thu, 12 Nov 1998 18:51:20 GMT, you wrote:

>Does anybody knows where that query does not work :
>
>select months_between('1996-02-01','1996-11-15')
>from dual;
>
>This Query return NULL. Is there a problem with the months_between function
>?
>
>Thanks.

Do you have more information? (whats the client, what api are you using, whats your nls_date_format, and so on)...

I just ran your example, no problems once I changed the nls_date_format:

SQL> select months_between('1996-02-01','1996-11-15')   2 from dual;
ERROR:
ORA-01843: not a valid month

no rows selected

SQL> alter session set nls_date_format = 'yyyy-mm-dd';

Session altered.

SQL> select months_between('1996-02-01','1996-11-15')   2 from dual;

MONTHS_BETWEEN('1996-02-01','1996-11-15')


                               -9.4516129


 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Nov 12 1998 - 13:10:03 CST

Original text of this message

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