Re: Default month in TO_DATE

From: CarlosAL <miotromailcarlos_at_netscape.net>
Date: Thu, 5 Mar 2009 00:24:29 -0800 (PST)
Message-ID: <51703c92-e063-4135-af8e-d3b5b2f96d58_at_s36g2000vbp.googlegroups.com>



On 3 mar, 20:08, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> "Malcolm Dew-Jones" <yf..._at_vtn1.victoria.tc.ca> a écrit dans le message de news: 4967e20..._at_news.victoria.tc.ca...
> |I don't see this in the TO_DATE documentation, and because it's January I
> | can't see how to test this to confirm.
> |
> | select to_date('2009','YYYY') from dual;
> | => shows 01-JAN-2009
> |
> | The day is defaulting to 1, but what of the month?
> |
> | - is the unspecified month defaulting to 1 (i.e. January)
> |
> | - or is the unspecified month defaulting to the current month (which just
> | happens to be January because of when I ran the test).
> |
> |
> | Thanks for any feedback.
> |
>
> SQL> select to_date('2009','YYYY') from dual;
> TO_DATE('2009','YYY
> -------------------
> 01/03/2009 00:00:00
>
> 1 row selected.
>
> Regards
> Michel

Hi all.

The default year, month and day is a little convoluted...

I wrote about it a while ago. You may take a look here:

http://carlosal.wordpress.com/2007/07/17/ojo-con-to_date/

It's written in spanish, but SQL is SQL is SQL ;-)

HTH. Cheers.

Carlos. Received on Thu Mar 05 2009 - 02:24:29 CST

Original text of this message