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'