add time interval to date function
823250Dec 13 2010 — edited Dec 13 2010trying to create a function that would add days+months+years to any date we'd supply.
trying to make this work -i know there is plethora of potential problems with this.
One of my fav msges keeps jumping back at me: "Warning: Function created with compilation errors."
line 7 is the problem no doubt - the datatypes.
------------------------------------------------------------
create or replace function nextexit (
p_date in date, p_years in integer, p_months in integer, p_days in integer)
return date
is
v_nextexit date(30);
begin
v_futuredate := p_date + INTERVAL p_years YEAR + INTERVAL p_months MONTH + INTERVAL p_days DAY;
return v_nextexit;
end;
/
-----------------------------------------------------
(alternatively i've been trying to use add_years/add_months/add_days functions but it seems like only the second one works???)
any help appreciated!