我在mysql中有这个触发器工作正常:
CREATE TRIGGER ins_trainee AFTER INSERT ON trainee
FOR EACH ROW UPDATE training_activities SET NO_of_Trainees =
( SELECT COUNT(SN)
FROM trainee
WHERE trainee.training_type = training_activities.SN
)
我试着像这样转换到oracle:
CREATE OR REPLACE TRIGGER ins_trainee
AFTER INSERT ON trainee
FOR EACH ROW
BEGIN
UPDATE training_activities SET NO_of_Trainees =
SELECT COUNT(SN)
FROM trainee
WHERE trainee.training_type = training_activities.SN;
END;
/
但我得到warning: trigger created with compilation errors
show errors
给出了:
2/1 PL/SQL: SQL Statemnet Ignored
2/49 PL/SQL: ORA-00936: missing expression