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!

filter using date and timestamp

1932140Mar 20 2018 — edited Mar 21 2018

A query I have to amend is currently filtering a timestamp based on an environment variable that is of type date.

i.e.

trunc(insert_timestamp) >= :cob_date + 1

However the index on insert_timestamp is not being used, so I was wondering if I change the filter to the following:

insert_timestamp > to_date(to_char(:cob_date + 1, 'dd/mm/yyyy')|| '23:59:59', 'dd/mm/yyyy hh24:mi:ss')

Would the filter possibly not catch some rows between 23:59:59 and midnight ?

The input date (:cob_date) is of the format dd/mm/yyyy with no time, which I assume time is therefore defaulted to 00:00:00.

insert_timestamp is a timestamp column.

Thanks

This post has been answered by Frank Kulash on Mar 20 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 17 2018
Added on Mar 20 2018
7 comments
4,407 views