Getting the number of days between two dates in Oracle 11g

1158340 pts.
Tags:
Oracle
Oracle 11g
I've been trying to find the number of days between two different dates in Oracle 11g. Here's what I have so far:
select sysdate - to_date('2009-10-01', 'yyyy-mm-dd') from dual
But it keeps returning an interval and I can't cast it to an integer too. Any idea what I should do here?
1

Answer Wiki

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

I am assuming that the error is originating from a programming language usage of the data returned. I used the following statement and received no oracle errors and was able to use the results in subsequent SQL statements.

select cast( trunc(sysdate – to_date(‘2009-10-01’, ‘yyyy-mm-dd’) as integer) as diff from dual

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: