I have two date strings, in the format MM/DD/YYYY and would like to query an Oracle database for any records between those two dates. How do I do this succ开发者_开发技巧inctly and simply?
Use the TO_DATE function:
WHERE date_column BETWEEN TO_DATE(start, 'MM/DD/YYYY')
AND TO_DATE(end, 'MM/DD/YYYY')
Try this,
SELECT * FROM table WHERE date BETWEEN to_date('01/05/2010','mm/dd/yyyy') AND to_date('10/01/2010','mm/dd/yyyy') ORDER BY date ASC
精彩评论