Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Date Fields
In article <7tt45e$3cm$1_at_nnrp1.deja.com>, amerar_at_ci.chi.il.us wrote:
>
>
>Hello,
>
>I have a question about date fields. We have a report that uses the
>date fields in the where clause. So, we created an index on this field
>to speed up the query. This works fine if we use a TO_DATE parameter.
>But if we use the TRUNC verb, then it seems like the index is not used
>because it takes forever......
>
>Why is this?
I suspect that the issue is one of using to_date on a variable or literal versus using trunc() on a database column. Something like...
select ... from myTable where trunc(myTable.myDateColumn) = '01-DEC-99';
will force a full table scan since the index on myTable.myDateColumn cannot be used due to the trunc() function.
![]() |
![]() |