Reputation: 6259
In the Oracle, how to do this date compare if column type is datetime ? I want to keep the string format 'MM/dd/yyyy' .
how to do this ?
Thanks
select * from my_tbl
where mycol >= '07/11/2012'
Upvotes: 4
Views: 6330
Reputation:
Assuming that date means July 11th:
select *
from my_tbl
where mycol >= to_date('07/11/2012', 'MM/DD/YYYY');
If that date should be November 7th:
select *
from my_tbl
where mycol >= to_date('07/11/2012', 'DD/MM/YYYY');
Depending on how you fill in the values for mycol, you might want to get rid of the time part as well:
select *
from my_tbl
where trunc(mycol) >= to_date('07/11/2012', 'DD/MM/YYYY');
Upvotes: 7