Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> help: to_date function

help: to_date function

From: Mike F <u518615722_at_spawnkill.ip-mobilphone.net>
Date: Mon, 28 Jan 2002 16:04:51 GMT
Message-ID: <l.1012233891.1126220703@[64.94.198.252]>


What is the correct way to use to_date function?

In some case, when I use

select (*) from test where
time > to_date ('2002-01-20 23:59:59','yyyy-mm-dd hh24:mi:ss')

and
time < to_date ('2002-01-24 23:59:59','yyyy-mm-ddhh24:mi:ss');

will cause a full table scan, I have to change it to

select (*) from test where
time > to_date (to_char('2002-01-20 23:59:59'),'yyyy-mm-dd hh24:mi:ss') and
time < to_date (to_char('2002-01-24 23:59:59'),'yyyy-mm-ddhh24:mi:ss');

in order for the index to be used.

In some cases,use
to_date('2002-01-24 23:59:59','yyyy-mmddhh24:mi:ss')  will be better than
to_date (to_char('2002-01-24 23:59:59'),'yyyy-mm-ddhh24:mi:ss');

Does anybody know why?

Thanks for you help  

-- 
Sent  by dbadba62 from  hotmail in area  com
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com/cgi/content/new
Received on Mon Jan 28 2002 - 10:04:51 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US