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: Rao, Maheswara <Maheswara.Rao_at_Sungardp3.com>
Date: Wed, 1 Nov 2000 11:47:30 -0500
Message-Id: <10667.120817@fatcity.com>


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-----
From: Glenn Travis [mailto:Glenn.Travis_at_wcom.com] Sent: Tuesday, October 31, 2000 4:51 PM
To: Multiple recipients of list ORACLE-L Subject: RE: how to define date column in a table with only mm/dd/yyyy por

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. Received on Wed Nov 01 2000 - 10:47:30 CST

Original text of this message

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