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!

to_date and to_char performance

81063Oct 7 2002
Hello,

I have a client with the following slow query that takes
9 seconds:

select * from client.client
where to_char(create_date,'J') = to_char(sysdat-1,'J');


Assume create_date is type date. We can easly speed this up:

select * from client.client
where ( create_date >= to_date(sysdate)
and create_date < to_date(sysdate));


This takes 0.07 seconds. The only catch is that the sessions
nls_date_format MUST be in a 'DD-MON-YYYY' format, or the query
will give false results. But that's no problems because we change
the ora.init file to specify nls_date_format globally.

My client is concerned that if ( big IF ), the nls_date_format
is changed for a session the query will fail and they are concerned.
Unlikely, but possible since we are using PHP with persistent
connetions and a previous query could change the nls_date_format
for that particular session.

Is there any solutions to this? Can we disable the nls_date_format
from begin altered at the session level?


Thanks

Jay




Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 5 2002
Added on Oct 7 2002
9 comments
1,864 views