Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Dates and Oracle
Hi,
If you don't need time information use
insert into table1 (the_date) values (trunc(sysdate)).
If you need time information use
select * from table1 where trunc(the_date) =
to_date('01-07-1998','dd-mm-yyyy') ...but possible index on the_date
will not be used
or
select * from table1 where the_date
between to_date('01-07-1998','dd-mm-yyyy') and
to_date('01-07-1998','dd-mm-yyyy')+1-1/(24*60*60).
Peter Rak
VSZ Kosice
Slovak Republic
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
Received on Wed Jul 01 1998 - 07:31:26 CDT
![]() |
![]() |