oracle数据库中怎么查询当前年每月的天数,按自然月统计,谢谢!

楼上的只统计了一个月的吧

WITH?t?AS

(SELECT?ROWNUM

FROM?DUAL

CONNECT?BY?ROWNUM?<=?12)

SELECTTO_CHAR?(LAST_DAY?(TO_DATE?(TO_CHAR?(SYSDATE,?'YYYY')

||?LPAD?(TO_CHAR?(ROWNUM),?2,?0),

'YYYYMM'

)

),

'YYYY-MM'

)

||?'月',

TO_CHAR?(LAST_DAY?(TO_DATE?(TO_CHAR?(SYSDATE,?'YYYY')

||?LPAD?(TO_CHAR?(ROWNUM),?2,?0),

'YYYYMM'

)

),

'DD'

)

||?'天'

FROM?t

直接全选复制粘贴运行