Check the data between two dates in an Oracle database

1136825 pts.
Tags:
Oracle 10g
Oracle Database
I have an Oracle database and I need to execute a query to check the data between two different dates. Here's what I have:
NAME               START_DATE    
-------------    ------------- 
Small Widget       15-JAN-10 04.25.32.000000 PM      
Product 1          17-JAN-10 04.31.32.000000 PM  



select * from  where start_date  
BETWEEN '15-JAN-10' AND '17-JAN-10'
But I'm not getting the results I want. Do I have to use "like" and "%"? If so, where do I put them? Thank you very much.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

You need to use the TO_DATE function in your WHERE clause, to convert your date strings to actual dates.

Your condition should be something like:

...BETWEEN TO_DATE('15-JAN-10 00:00:00','dd-mon-yy hh24:mi:ss') AND TO_DATE('17-jan-10 23:59:59','dd-mon-yy hh24:mi:ss')

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: