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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: how to define date column in a table with only mm/dd/yyyy por

Re: how to define date column in a table with only mm/dd/yyyy por

From: Scott Canaan <srcdco_at_ritvax.isc.rit.edu>
Date: Wed, 01 Nov 2000 13:33:58 -0500
Message-Id: <10667.120834@fatcity.com>


Rao,

    Yes, it's a common mistake:
 dbms_output.put_line (to_char(d11, 'dd-MON-yyyy HH:MM')); should be:
 dbms_output.put_line (to_char(d11, 'dd-MON-yyyy HH:MI'));

You are getting the month for the minutes. The abbreviation MM is month, MI is for minutes.

"Rao, Maheswara" wrote:

> Hi All,
>
> Thanks to all of you that took the time to answer the question.
>
> Now, regarding the environment. We process broker trades and pass them for
> execution to stock exchanges. I store these trade messages into a file.
> Now, we need to compare different trade messages based on the date -
> dd/mm/yyyy portion only. (to deal with duplicate trade messages). Hence, I
> thought whether it is possible to create a date column that will store only
> dd/mm/yyyy but not the time. Now, I will start using TRUNC before
> inserting/updating the column. (Earlier I did not know this TRUNC. Thanks to
> the list for this.
>
> I wrote a small test procedure. Following is the one
>
> create or replace procedure d1 as
>
> d11 date;
> d12 date;
>
> Begin
>
> d11 := to_date('10-OCT-1999 10:56:20' , 'dd-MON-yyyy HH:MI:SS');
> d12 := to_date('10-OCT-1999 11:35:20' , 'dd-MON-yyyy HH:MI:SS');
>
> if trunc(d11) = trunc(d12)
> then
> dbms_output.put_line ('YES');
> else
> dbms_output.put_line ('NO');
> end if;
>
> d11 := trunc(d12);
> dbms_output.put_line (to_char(d11, 'dd-MON-yyyy HH:MM'));
>
> END d1;
>
> /
>
> show errors;
>
> QUESTION:
>
> The above program always is outputting the time portion as 12:10 in the time
> portion (example: 10-OCT-1999 12:10) Can anybody please explain to me the
> reason for this?
>
> Thanks,
>
> Rao
>
> Maheswara.Rao_at_SunGardP3.com
>
> -----Original Message-----
> Sent: Tuesday, October 31, 2000 4:51 PM
> To: Multiple recipients of list ORACLE-L
>
> Maybe he wants to run date comparisons on the field. In that case, the
> comparison would fail unless the seconds match. If he only stored the DATE
> portion, then more comparisons would match. 01-Nov-2000 = 01-Nov-200 BUT
> 01-Nov-2000:01:01:00 != 01-Nov-2000:01:01:01.
>
> We need more information to understand why he is wanting to do this.
>
> << rest of the messages deleted >>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Rao, Maheswara
> INET: Maheswara.Rao_at_Sungardp3.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

--
Scott Canaan (srcdco_at_rit.edu)
"Life is like a sewer, what you get out of it depends on what you put into it" -
Received on Wed Nov 01 2000 - 12:33:58 CST

Original text of this message

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