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: to_char put into a date?

Re: to_char put into a date?

From: Robert William Vesterman <bob.work_at_vesterman.com>
Date: Thu, 27 Sep 2001 16:56:04 -0400
Message-ID: <h247rtkiof2iuu5qrvterlqck2t8m6mn84@4ax.com>


On Thu, 20 Sep 2001 07:23:25 GMT, Matthias Gresz <nospam_at_newsranger.com> wrote:

>You should use time_processed = sysdate instead of the to_char-conversion.

I understand that. I was surprised when I saw that the person had attempted to stick a to_char (sysdate, 'blah') into a date field, and I was further surprised when I saw that Oracle ALLOWED that to be done without returning some sort of error.

>At
>the moment you seem to be lucky, that the box you ran the population from has
>NLS_DATE set in a way that it understands 'MM/DD/YYYY HH24:MI:SS'. May be it's
>setting is 'DD/MM/YYYY HH24:MI:SS' so you will run into problems with some
>dates.

I don't believe this is the case - like I said, I can no longer treat it as a date field, I must treat it as a char field, even though the column itself is a date, not a char or varchar or whatever. That is, in order to treat the stuff that I get out of the date field as a date, I now have to do a to_date on it. Since I specify the format in the to_date, I don't think there's an issue like you imply where DD and MM could potentially get confused.

>Don't know what the programmer thought about converting date to char to store it
>in a date field.

I know, but unfortunately it's there.

Bob Vesterman. Received on Thu Sep 27 2001 - 15:56:04 CDT

Original text of this message

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