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

Home -> Community -> Usenet -> c.d.o.server -> Re: Dates and Oracle

Re: Dates and Oracle

From: Marcus Reichardt <mr_at_diamanda.hh.eunet.de>
Date: Wed, 01 Jul 1998 14:48:19 +0200
Message-ID: <359A3013.1219@diamanda.hh.eunet.de>


Linda Harte wrote:
>
> We have several client server applications connecting to
> Oracle 7.3 and have just discovered some problems
> with dates.
>
> One application inserts sysdate into a table
> insert into table1 (the_date) values (sysdate)
>
> Another apllication selects data from this table and
> does some further processing and this is where the
> problem arises
> select * from table1 where the_date =
> to_char('01-07-1998','dd-mm-yyyy')
>
> This returns no rows although if we do a
> select the_date from table1 we see that
> there is one record with date 01-JUL-97.
>
> It appears that SYSDATE inserts the current
> time into the column as well and hence the
> problem when trying to select data.
>
> Any ideas on how to overcome this or how
> to deal with dates in oracle
>
> Thanks
>
> Linda

This is easy to overcome:

If you INSERT sysdate into a DATE collumn, you indeed insert the current db time as well. All you have to do is to truncate the time component:

INSERT INTO table (the_date) values (to_date(to_char(sysdate, 'dd-mm-yyyy'), 'dd-mm-yyyy')

Marcus Reichardt
Consultant Received on Wed Jul 01 1998 - 07:48:19 CDT

Original text of this message

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