CREATE TRIGGER Background_Process_Report_trit
AFTER INSERT
ON Background_Process_Report
FOR EACH ROW
IF INSERT(PROCESS_NAME)
BEGIN
SET EXECUTION_TIMESTAMP := NEW.TIMESTAMP;
END;
/
process_name -- column in my Background_Process_Report table.but i want to update the each time the process_name is created(by java application), trigger update the time in the EXECUTION_TIMESTAMP table. but it is throwing the compliation error..
error:
IF INSERT(PROCESS_NAME) * ERROR at line 5: ORA-04079: invalid trigger specification
how to reslove this error
From stackoverflow
-
If EXECUTION_TIMESTAMP is a table as you say, then it must have a column you want to update, let's call it TIMESTAMP_COL. The the trigger would be something like:
CREATE TRIGGER Background_Process_Report_trit AFTER INSERT ON Background_Process_Report FOR EACH ROW WHEN (NEW.PROCESS_NAME IS NOT NULL) BEGIN UPDATE EXECUTION_TIMESTAMP SET TIMESTAMP_COL = NEW.TIMESTAMP WHERE ???; -- Change ??? to the appropriate condition END; /
I have assumed that by "IF INSERT(PROCESS_NAME)" you mean "if a non-null value is inserted into PROCESS_NAME" and created a WHEN clause to match.
murali : Thanks...it is working finePeter Lang : @murali: If this answer is working for you, please consider [accepting it](http://meta.stackoverflow.com/questions/5234/accepting-answers-what-is-it-all-about).
0 comments:
Post a Comment