dbTalk Databases Forums  

'DD-MON-YY' v. 'DD-MON-YYYY' question

comp.databases.oracle comp.databases.oracle


Discuss 'DD-MON-YY' v. 'DD-MON-YYYY' question in the comp.databases.oracle forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
DBF
 
Posts: n/a

Default 'DD-MON-YY' v. 'DD-MON-YYYY' question - 10-11-2007 , 09:10 PM







I have a table in Oracle9i that has an index on a Date field. The
NLS_DATE_FORMAT is set to 'DD-MON-YY'. If I run a query on the table
and compare the date field as >= '01-OCT-07' the execution plan uses
the index and the query returns in < 1 seconds.

However if I use '01-OCT-2007' for the comparision to the date field.
It does a full table scan and returns in 8 seconds.

In addition, if I use the Oracle to_date('01-OCT-2007') it also does a
full table scan and returns in 8 seconds.

Examples:

select *
from mytable
where mydate >= '01-OCT-07'

results in Index usage on mydate and returns in < 1 seconds

select *
from mytable
where mydate >= '01-OCT-2007'

results in full table scan and returns in 8 seconds

select *
from mytable
where mydate >= to_date('01-OCT-2007')

results in full table scan and returns in 8 seconds

The table was just fully analyzed last night in an attempt to fix this
problem, to no avail.

Any ideas why this is happening?
What should I look for in my Oracle settings?

thank you for any help or suggestions.

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.