我正在尝试创建一个AFTER INSERT TRIGGER ON Certificare,它将更新该特定人员的“salariu”值,由“idan”标识旧值+ 100 ..我确实编写了跟随触发器,当我尝试插入Certificare它说如下:04098。00000 - “触发'%s。%s'无效且重新验证失败”
以下是2个表和触发器:
CREATE TABLE Angajati(
idan INT PRIMARY KEY,
numean VARCHAR(30),
salariu INT
);
CREATE TABLE Certificare(
idan INT,
idav INT,
PRIMARY KEY(idan,idav),
FOREIGN KEY (idan) REFERENCES Angajati(idan),
FOREIGN KEY (idav) REFERENCES Aeronave(idav)
);
CREATE TRIGGER trigNou
AFTER INSERT ON Certificare
BEGIN
UPDATE Angajati
SET salariu=salariu+100
WHERE new.idan IN (SELECT idan FROM Angajati);
END;
PS:我在SQL Developer
工作答案 0 :(得分:1)
我希望这样的事情:
CREATE TRIGGER trigNou AFTER INSERT ON Certificare
FOR EACH ROW
BEGIN
UPDATE Angajati
SET salariu = salariu+100
WHERE :new.idan = Angajati.idan;
END;