Dear All,
Test for Leap Years
select year,
decode( mod(year, 4), 0,
decode( mod(year, 400), 0, 'Leap Year',
decode( mod(year, 100), 0, 'Not a Leap Year', 'Leap Year')
), 'Not a Leap Year'
) as leap_year_indicator
from my_table
Have a pleasant time
Dear All,
Test for Leap Years
select year,
decode( mod(year, 4), 0,
decode( mod(year, 400), 0, 'Leap Year',
decode( mod(year, 100), 0, 'Not a Leap Year', 'Leap Year')
), 'Not a Leap Year'
) as leap_year_indicator
from my_table
Have a pleasant time
What about simply using this one.
Code:SELECT DECODE(TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,' y'),1)),'DD'),28 ,'Not a Leap Year','Leap Year') FROM dual
Try this also
Code:SELECT DECODE((LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'YYYY'),11)) - TRUNC(SYSDATE,'YYYY'))+1,365,'NOT A LEAP YEAR',366,'LEAP YEAR') FROM DUAL;