更新时间:2023-11-29 14:03:52
to_date()
中的格式掩码也必须用单引号引起来.
The format mask in to_date()
must be enclosed within single quotes too.
要生成字符串格式的输出,您需要应用具有相同格式掩码的to_char()
.
To produce the output in string format you need to apply to_char()
with the same format mask.
select to_char(to_date('20160101', 'YYYYMMDD') + level - 1, 'YYYYMMDD') as dt
from dual
connect by level <= 1 + to_date('20160104', 'YYYYMMDD') - to_date('20160101', 'YYYYMMDD')
;
DT
--------
20160101
20160102
20160103
20160104