I’m trying to retrieve records from table by knowing the date in column contains date and time.
Suppose I have table called t1 which contains only two column name and date respectively.
The data stored in column date like this 8/3/2010 12:34:20 PM.
I want to retrieve this record by this query for example (note I don’t put the time):
Select * From t1 Where date="8/3/2010"
This query give me nothing !
How can I retrieve date by knowing only date without the time?
DATEis a reserved keyword in Oracle, so I’m using column-nameyour_dateinstead.If you have an index on
your_date, I would useor
BETWEEN:If there is no index or if there are not too many records
should be sufficient.
TRUNCwithout parameter removes hours, minutes and seconds from aDATE.If performance really matters, consider putting a
Function Based Indexon that column: