0

I am trying to select data from my table on or before a given time in my parameter.

This is my current query:

SELECT Expiry_Date FROM Table1
WHERE Expiry_Date <= :dateParam AND Expiry_Date > sysdate

The problem is dates on my table with data such as 14-NOV-13 03.01.45.362000000 PM which has a time part of more than 12.00.00.000000000 AM are not being returned in the result. So that if I enter 14-NOV-13 as the parameter, the data with 14-NOV-13 03.01.45.362000000 PM is not being returned.

How could I just get the date part or try to floor function the date column in my field?

1 Answer 1

3

You can do either in Oracle. trunc works on date times:

where trunc(Expiry_date) <= :dateParam and Expiry_Date > trunc(sysdate)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.