Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

creating index on datepart of datetime field

883189Sep 9 2011 — edited Sep 10 2011
Hello all,

I need to create an index on date part of datetime field column. My sample datefiled column values are as follows:

10/24/2009 12:09:58 PM
10/25/2009 7:05:19 AM
10/20/2009 9:52:25 AM
10/29/2009 11:5:21 PM
10/30/2009 9:8:17 PM

Which function can be used to create index - to_date or to_char ?

I tried running the following querys :

create index tmp on table1(to_date(datecolumn,'DD-MM-YYYY'));

create index tmp on table1(to_char(datecolumn,'mm/dd/yyyy'));

the above two querys works.
But below query doesn't wrk..

create index tmp on table1(to_date(datecolumn,'mm/dd/yyyy'));

why and which to use and how?

help is really appreciated...thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 8 2011
Added on Sep 9 2011
14 comments
12,055 views