views:

41

answers:

2

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 succinctly and simply?

+1  A: 

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
Riddari
Answered your own question inside of two minutes, eh?
OMG Ponies
Yeah, usually I use SO as a parallel research tool. If I need to know something, I'll set the community on it on SO and search for the answer myself at the same time.
Riddari
@Riddari wow - really? Remind me not to spend time on your questions until I give you some time to try a search engine first.
Christopherous 5000
Also I think this one in particular I didn't find a good source for elsewhere, so I put it here for others to find.
Riddari
+3  A: 

Use the TO_DATE function:

WHERE date_column BETWEEN TO_DATE(start, 'MM/DD/YYYY')
                      AND TO_DATE(end, 'MM/DD/YYYY')
OMG Ponies