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 - 我的Background_Process_Report表中的列。但是我想更新每次创建process_name时(通过java应用程序),触发更新EXECUTION_TIMESTAMP表中的时间。 但它正在抛出恭维错误..
错误:
IF INSERT(PROCESS_NAME) * ERROR at line 5: ORA-04079: invalid trigger specification
如何重新发送此错误
答案 0 :(得分:4)
如果您说的是EXECUTION_TIMESTAMP是一个表,那么它必须有一个您想要更新的列,我们称之为TIMESTAMP_COL。触发器将是这样的:
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;
/
我假设“IF INSERT(PROCESS_NAME)”是指“如果将非空值插入PROCESS_NAME”并创建了WHEN子句以匹配。