Re: problem in to_date function

From: KULJEET <kuljeet_twtpl_at_hotmail.com>
Date: 25 Aug 2003 21:55:01 -0700
Message-ID: <febbed51.0308252055.388c404a_at_posting.google.com>


"Nic" <nicpayre[junk]_at_sympatico.ca> wrote in message news:<Fft2b.2935$Cg2.348402_at_news20.bellglobal.com>...
> Hi,
> for part of your question related to the performance, i think you could modify your query to get
>
> select * from c_table where n_date = to_date('21/08/03','DD/MM/YY');
>
> so the to_date function get call only once, of course if you have store the date data with differents time you still will need to
> call the trunc function.
>
> select * from c_table where trunc(n_date) = to_date('21/08/03','DD/MM/YY');
>
> "KULJEET" <kuljeet_twtpl_at_hotmail.com> wrote in message news:febbed51.0308222045.3f3b3845_at_posting.google.com...
> > hi
> > i have a table c_table with two columns
> > no,
> > date
> > it contains records
> >
> > no n_date
> > 1 10-AUG-03
> > 2 21-AUG-03
> >
> > when we issue
> > select * from c_table where n_date='10-AUG-03';
> > it will successfully return the record
> >
> > but when we give
> > select * from c_table where n_date='21-AUG-03';
> >
> > it will not return the record
> >
> > after using to_date function like
> > select * from c_table where to_date(n_date,'DD/MM/YY')='21/08/03';
> >
> > it will successfully return the records
> > but the main problem is that
> > when we have table that contains 50,000,00 records
> > **and then using to_date function then it will slow down the performance
> >
> > how we can solve the.

the main problem is that in
when i issue



select to TO_CHAR(N_DATE,'DD/MM/YY HH24:MI') from c_table the it will return
10/08/03 00:00
10/08/03 00:00
10/08/03 00:00
21/08/03 16:21
----------------

so
10/08/03 date it will store time as 00:00 10/08/03 00:00

but in 21/08/03 it will store time as 16:21

21/08/03 16:21

BUT IT WILL NOT WORK
select * from c_table where n_date = to_date('21/08/03','DD/MM/YY');
BUT THIS WILL WORK
select * from c_table where trunc(C_date) = to_date('21/08/03','DD/MM/YY'); CAN TRUNC FUNCTION SLOW DOWN THE PERFORMANCE???? Received on Tue Aug 26 2003 - 06:55:01 CEST

Original text of this message