I'm looking to create a package, already have a working procedure. Working on a function, step by step and I have encountered an
ORA-06575: Package or function PROJECT_LENGTH is in an invalid state
error.
The aim of this is to eventually be able to show how long my project lasted, from startdate to enddate in months. How do I fix this issue?
I have tried various different approaches and examples. I have checked all variables are correct.
CREATE OR REPLACE FUNCTION project_length(startDate IN DATE,
endDate IN DATE) RETURN NUMBER IS
BEGIN
RETURN FLOOR(MONTHS_BETWEEN(startDate, endDate) / 12);
END;
/
Testing :
SELECT projectname, project_length(startDate,endDate)
FROM project
WHERE project_length(startDate,endDate) > 0;
I'm expecting an output which will consist of the projectName and Project Length, displaying the amount of months a project took