Year Month Analysis
-- Year, Month and related index values


SELECT
 start_yr+CEIL(level/12)-1||
  LPAD(DECODE(MOD(level,12), 0, 12,
              MOD(level,12)),2,0)  Year_month_idx,
 start_yr+CEIL(level/12)-1  year_idx,
 DECODE(MOD(level,12),
    0, 12, MOD(level,12))   month_idx   
FROM (SELECT &yyyy start_yr 
      FROM  DUAL) DUAL
CONNECT BY level < 19
;

   Date Time Functions    Date - Week    Gregorian Calendar

Oracle registered trademark of Oracle Corporation.

Last Revised On: October 11th, 2014

  256