Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

add time interval to date function

823250Dec 13 2010 — edited Dec 13 2010
trying 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!
This post has been answered by 706888 on Dec 13 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2011
Added on Dec 13 2010
7 comments
463 views