SQL:
select to_char((sysdate-interval'1'day),'yyyy-mm-dd') as yesterday, to_char((sysdate-interval'1'month),'yyyy-mm-dd') as oneMonthAgo, to_char((sysdate-interval'1'year),'yyyy-mm-dd') as oneYearAgo from dual
执行效果:
SQL> select 2 to_char((sysdate-interval'1'day),'yyyy-mm-dd') as yesterday, 3 to_char((sysdate-interval'1'month),'yyyy-mm-dd') as oneMonthAgo, 4 to_char((sysdate-interval'1'year),'yyyy-mm-dd') as oneYearAgo 5 from dual; YESTERDAY ONEMONTHAGO ONEYEARAGO -------------------- -------------------- -------------------- 2021-10-19 2021-09-20 2020-10-20
END