Majk Johnoson
Majk Johnoson

Reputation: 39

Finding a range date in sql , oracle

I want to find the date from one given date to today date . But my code doesent show anything.Any tipp?

select * from orders 
where order_date between to_date('2014-06-09','yyyy-mm-dd') and to_date(sysdate,'yyyy-mm-dd')

Upvotes: 1

Views: 48

Answers (1)

Vamsi Prabhala
Vamsi Prabhala

Reputation: 49260

When you do to_date(sysdate,'yyyy-mm-dd'), the year part would be 0015 instead of 2015. Hence you don't get any results.

Use trunc(sysdate) instead.

Upvotes: 1

Related Questions