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
months_between()
call so you get a positive result...) – Abagail/
not being seen as the block terminator for instance. For instance, SQuirreL or DBeaver don't really get PL/SQL and might error after the first semicolon in the function. If so, try using a different client, like SQL Developer. – AbagailSHOW ERROR FUNCTION <FUNCTION NAME>
may help you find out where the problem is. If the function is ok, then that command will returnNo errors.
– Hiddenite