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 parse the year from a date.

Amer Ramamni-OracleMay 28 2012 — edited May 28 2012
Hi,

I have the following date format in database.

05-SEP-07
18-OCT-07
18-OCT-07
25-JUL-07
18-OCT-07

What I am trying to do is get only the full year from the date, example

2007
2008
2009

I tried to use extract function but that doesn't work due to ORA-01843: not a valid month.

Thanks in advance.
select extract(year from date '18-OCT-07') from dual;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 25 2012
Added on May 28 2012
2 comments
844 views