日期:2014-05-17  浏览次数:20820 次

如何获取当前的年,月
请教各位大虾,如何只获取当前的年。并且转化成number格式

------解决方案--------------------
SQL> select to_number(to_char(sysdate, 'yyyy '))year from dual;

YEAR
----------
2007

SQL> select to_number(to_char(sysdate, 'yyyymm '))year from dual;

YEAR
----------
200708

SQL> select to_number(to_char(sysdate, 'yyyymmdd '))year from dual;

YEAR
----------
20070823