I am trying to check a condition if given date is in current financial year i.e april to march. but not getting any idea how to do
code
select nvl(Count(1), 0)+1 from ASET where IPE='O' and irt in (SELECT EXTRACT (YEAR FROM ADD_MONTHS (SYSDATE, -3)) || '-' || EXTRACT (YEAR FROM ADD_MONTHS (SYSDATE, 9)) FROM DUAL)
irt is date 01-09-2020.
Advertisement
Answer
I think the simplest approach is to offset the date column and sysdate
by 3 months, and compare the year part:
where to_char(add_months(irt, -3), 'yyyy') = to_char(add_months(sysdate, -3), 'yyyy')