您可以通过从对偶中选择日期值并将它们结合在一起来创建公用表表达式(CTE,子查询分解等)。
with RTG_YEARS (YR) as ( select to_date('2013-01-01', 'yyyy-mm-dd') from dual union all select to_date('2013-12-31', 'yyyy-mm-dd') from dual union all select to_date('2014-01-01', 'yyyy-mm-dd') from dual union all select to_date('2014-12-31', 'yyyy-mm-dd') from dual union all select to_date('2015-01-01', 'yyyy-mm-dd') from dual union all select to_date('2015-12-31', 'yyyy-mm-dd') from dual)select * from RTG_YEARS;YR ----------2013-01-012013-12-312014-01-012014-12-312015-01-012015-12-31
与CTE无关,但是您可以通过使用日期文字来减少输入:
with RTG_YEARS (YR) as ( select date '2013-01-01' from dual union all select date '2013-12-31' from dual union all select date '2014-01-01' from dual union all select date '2014-12-31' from dual union all select date '2015-01-01' from dual union all select date '2015-12-31' from dual)select * from RTG_YEARS;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)