Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Trigger problem - ORA-04098
I am writing an OCI application that creates tables and also creates triggers on the tables, such that an insert causes an event to be logged. The application later does inserts, which are supposed to cause the trigger to fire.
However, the inserts fail with the error
"ORA-04098: trigger 'NEWTABLE_IT' is invalid and failed re-validation"
If I submit the same insert from an SQL prompt (after the application has created the trigger) I also get this error.
BUT - if I recreate the trigger by pasting the trigger body into the SQL window (without any changes at all), then the trigger fires correctly and the insert is successful! Likewise, the inserts that are done from the application are also successful if I create the trigger from SQL (assuming I bypass the code so that the trigger doesn't get replaced).
I am using the same login from both SQL and the application.
This smells like a permissions problem of some kind, but I can't find anything in the docs about it. Can anybody clue me in?
The trigger (VERY simplified) looks something like this:
CREATE OR REPLACE TRIGGER NEWTABLE_IT
AFTER INSERT ON NEWTABLE
FOR EACH ROW
DECLARE
EVENT INTEGER;
BEGIN
EVENT := 1;
INSERT INTO EVENT_LOG (EVENT_NUM, KEYVALUE) VALUES (EVENT, :NEW.KEY);
END;
/
Received on Wed Sep 10 1997 - 00:00:00 CDT