this function retrun the date of the last day in the month
CREATE OR REPLACE FUNCTION "GET_LAST_DAY_OF_MONTH"
( p_dateinmonth in date
) return date as
v_datereturn DATE;
begin
select (TRUNC( ADD_MONTHS(p_dateinmonth,1), 'MM' ))-1 into v_datereturn
from dual;
return v_datereturn;
end get_last_day_of_month;
/