我想使用由于插入该记录而触发的触发器来更新相同的记录。
当我尝试使用以下代码执行此操作时,会出现错误
DROP TRIGGER CONTROLLER_UPLOADER;
CREATE OR REPLACE TRIGGER CONTROLLER_UPLOADER
after insert ON CONTROLLER for each row
begin
UPDATE CONTROLLER SET STATUS = 'STARTED' WHERE ID = (SELECT MAX(ID) FROM CONTROLLER);
end;
答案 0 :(得分:3)
DROP TRIGGER CONTROLLER_UPLOADER;
CREATE OR REPLACE TRIGGER CONTROLLER_UPLOADER
BEFORE insert ON CONTROLLER for each row
begin
:NEW.STATUS := 'STARTED';
end;
注意“BEFORE”不是“AFTER”。