I am getting ORA-00905: missing keyword
error when trying to run the following query in 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;
The individual Between
clauses work fine, so I am assuming there is something wrong with the Case
syntax.
Any ideas?