I created a funcion like this
CREATE OR REPLACE FUNCTION tax
(p_sal IN NUMBER(4))
RETURN NUMBER
AS
v_tax NUMBER(4);
BEGIN
v_tax:= CASE
WHEN p_sal> 4000 THEN
p_sal*0.33
WHEN p_sal >2500 THEN
p_sal*0.25
WHEN p_sal >1500 THEN
p_sal*0.20
ELSE 0
END;
RETURN v_tax;
END;
/
when i used this tax function in insert stmt like
INSERT INTO employees(eno, ename, job, join_date, sal, comm)
VALUES (7784,'allen','salesman',sysdate, 5000, tax(5000));
it shows the error like
ERROR: ORA-O6575: package or function tax is in invalid state.
can anyone suggest me how to make this function is in valid state? thanks in advance.
Check errors with this command:
Select * from user_errors where name='Your function name'
A function is compiled like this:
alter function tax compile;
Then, check for compilation errors with:
SHOW ERRORS
There are two main reasons while an object in Oracle is invalid:
Also, some database connection drivers keep references to objects in the database. If the state of those object change in the database the references go stale and you will get an error similar to the one above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With