I am using TD13 version.I have a query which runs for on particular dates.Whenever the query runs it has to pick up the last quarter dates.
How to extract last quarter dates in BETWEEN condition in TD without accessing calendar table.
The discussion , with calendar or without calendar is in this link. You could have searched for it :).
Now for the date logic, you can write case when statement to suit your requirement.
What's your TD release?
In 14 there's Oracle's TRUNC:
WHERE datecol BETWEEN TRUNC(ADD_MONTHS(CURRENT_DATE,-3), 'Q'), TRUNC(CURRENT_DATE, 'Q') - 1
Before it's more complicated:
WHERE datecol BETWEEN ADD_MONTHS(CURRENT_DATE - (EXTRACT(DAY FROM CURRENT_DATE) -1), -(EXTRACT(MONTH FROM CURRENT_DATE) + 2) MOD 3 - 3)
AND ADD_MONTHS(CURRENT_DATE - (EXTRACT(DAY FROM CURRENT_DATE) -1), -(EXTRACT(MONTH FROM CURRENT_DATE) + 2) MOD 3) - 1