年:
SQL> select to_char(sysdate,'yyyy') from dual;TO_CHAR(SYSDATE,'YYYY')
-----------------------
2004
月:SQL> select to_char(sysdate,'mm') from dual;TO_CHAR(SYSDATE,'MM')
---------------------
08
日:
SQL> select to_char(sysdate,'dd') from dual;TO_CHAR(SYSDATE,'DD')
---------------------
30年日:SQL> select to_char(sysdate,'yyyy-dd') from dual;TO_CHAR(SYSDATE,'YYYY-DD')
--------------------------
2004-30年月:
SQL> select to_char(sysdate,'yyyy-mm') from dual;TO_CHAR(SYSDATE,'YYYY-MM')
--------------------------
2004-08月日:
SQL> select to_char(sysdate,'mm-dd') from dual;TO_CHAR(SYSDATE,'MM-DD')
------------------------
08-30

解决方案 »

  1.   

    substr(etime,1,2)  用这个函数
      

  2.   

    显示的数据时用case...when就可以了select case 月份 when 1 then select 月份,金额 from 表 where 月份=1,when 2 then select 月份,金额 from 表 where 月份=2 end case from 表
      

  3.   

    select case 月份 when 1 then select 月份,金额 from 表 where 月份=1,when 2 then select 月份,金额 from 表 where 月份=2 end case from 表问题是你的日期不固定,这只能算作权宜之计!
      

  4.   

    TO magic21(天天向上):我当然知道要建一个临时表,问题是我不知道怎样去建这个临时表啊???请把方法完整的写出来,如果嫌分少的话,我可以再加!