我在oracle sql中使用下面的代码,但想要更改格式。
select TRUNC(SYSDATE, 'Q') - 1 as LAST_DAY_OF_LAST_QTR
from dual
结果: 09/30/2017 12:00:00 AM
如何将其更改为 20170930
答案 0 :(得分:2)
附加TO_CHAR:
select to_char(TRUNC(SYSDATE, 'Q') - 1, 'yyyymmdd') as LAST_DAY_OF_LAST_QTR
from dual