SQL代码如下:
SELECT sn AS 季度, (sn - 1) * 3 + 1 AS 开始月份, ADD_MONTHS(TRUNC(TO_DATE(年, 'yyyy'), 'yy'), (sn - 1) * 3) AS 开始日期, ADD_MONTHS(TRUNC(TO_DATE(年, 'yyyy'), 'yy'), sn * 3) - 1 AS 结束日期 FROM (SELECT '2015' AS 年, LEVEL AS sn FROM DUAL CONNECT BY LEVEL <= 4);
执行结果如下: