Add/Subtract Interval from TIMESTAMP
Hi All,
I have a requirement to subtract number of days or months or weeks from a Timestamp column and get a timestamp value in return.
Assume I have the following table -
Table Name : Test
Columns:
Effective_End_Date : TIMESTAMP
Interval_type : VARCHAR2
Interval_value : NUMBER
Typically, one would go with the following query -
Select Effective_End_Date - Interval '1' DAY from test;
The issue is for I have to subtract the value stored in interval_value stored in the table from the effective_end_date. Also, the interval type (DAY, MONTH, etc) is stored in the INTERVAL_TYPE.
Could anyone suggest any query for this? Let me know if more inputs are required.
Thanks,
Maithily.