First a couple comments on the changes you indicated you made to the function:
- Removing the "IN" from the declaration actually accomplishes nothing.
If you do not specify "IN', "OUT", or "IN OUT" the compiler defaults to "IN". All removing it does is a change from an explicit to implicit declaration.
- Placing a semi-colon (;) where indicated will generate an error.
As for the function itself you are making it way more complicated than necessary. A simple assignment is all that's needed. Also, Boneist's suggestion of add_months is the correct function for adding years as it will adjust for leap year and number of days per month (if needed).
Thus your function reduces to:
create or replace function edor_date(dofa in date)
return date
is
l_edor_date date;
begin
l_edor_date := add_months(dofa, 35*12) ;
return l_edor_date ;
end;
or even further to just:
create or replace function edor_date (dofa in date)
return date
is
begin
return add_months(dofa, 35*12) ;
end;
BTW: I actually like the idea of using a function for this as it hides the implementation details of the business rule. However, it does impose a slight overhead for each call.