I have an oracle DATE column and the value of a particular record for the column is
16/10/2005 11:13:34 AM.
Now I am putting in a filter like this where the filter string is passed in from the front end.
date_col between to_date('16-10-2005','DD-MM-YYYY') and to_date('16-10-2005','DD-MM-YYYY')
It returns zero records. Why is this happening? I was thinking oracle would return all records that have a date of 16/10/2005 irrespective of the time.
Do i need to pass in thetime also/From the front end, I only get date and not time.
will only return
DATEvalues of midnight on October 16, 2005. If you want to fetch data for any time on October 16, 2005will do it. So would
If you fail to subtract that second, you’ll also end up pulling rows that have a
date_colvalue of midnight on October 17, 2005.You could also apply a
truncfunction to yourdate_colbut that would prevent a standard index on
date_colfrom being used. You would generally need to create a function-based index ontrunc(date_col)