Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get the difference in years from sysdate

user546710Jun 12 2012 — edited Jun 12 2012
Hi all,

I want to display years from 2005 to sysdate. I have tried this, but it is giving same SYSDATEs year 6 times.

SELECT EXTRACT(YEAR FROM SYSDATE + LEVEL -1) FROM DUAL CONNECT BY LEVEL < TRUNC(MONTHS_BETWEEN (SYSDATE,TO_DATE('2005','YYYY'))/12)

Thanks in advance,
Pal
This post has been answered by vijayrsehgal-Oracle on Jun 12 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 10 2012
Added on Jun 12 2012
10 comments
1,736 views