ORA-00905: missing keyword
尝试在 Oracle 中运行以下查询时出现错误:
select distinct MONTH_ID
from DSS_MAIN.DIM_TIME a1
where Case When TO_CHAR(SYSDATE,'MM') < 3
Then TO_CHAR(a1.MONTH_START_DATE,'YYYYMM') Between (TO_CHAR(SYSDATE,'YYYY')-1)||'03' And TO_CHAR(SYSDATE,'YYYYMM')
Else TO_CHAR(a1.MONTH_START_DATE,'YYYYMM') Between TO_CHAR(SYSDATE,'YYYY')||'03' And TO_CHAR(SYSDATE,'YYYYMM')
End;
各个Between
子句工作正常,所以我假设Case
语法有问题。
有任何想法吗?