how to convert date into month number?

Taoqir picture Taoqir · Dec 26, 2012 · Viewed 65.4k times · Source

I have a column Month in my table. The month name and date are stored in this month column like

Month    
01-JAN-12 
02-FEB-12 

and so on.

How do I convert the DATE into month number such as

Month
1 
2 

etc.

Answer

Mari picture Mari · Dec 26, 2012
select 
to_char(to_date('01-JAN-12','dd-mon-yy'),'mm') from dual;