how can the date be calculated depending on the input of a user? That is, depending on what the user enters, 3 months will be added to the current date or 5, etc.
I tried to add a computation to the date pickers:
I added as well a computation to this date with the following pl/sql function body, but it is not working.
DECLARE
sub_date DATE default null;
BEGIN
if :P75_THESISTYPE =1
then
sub_date := :P75_SUBMISSION_DATE +6;
else
sub_date := :P75_SUBMISSION_DATE +3;
END IF;
return sub_date;
end;
@TonyAndrews has the correct process, but as he followed your initial statement, it will not give the desired result. Adding an integer to a data add that number of days not months. What you need is the ADD_Months function; So:
DECLARE
sub_date DATE default null;
BEGIN
if :P75_THESISTYPE =1
then
sub_date := add_months(to_date(:P75_SUBMISSION_DATE),6);
else
sub_date := add_months(to_date(:P75_SUBMISSION_DATE),3);
end if
return sub_date;
end;
/
Of course the above assumes your variable's format matches your nls_data_format. Generally a dangerous assumption at best,