我正在创建一个触发器:
CREATE OR REPLACE TRIGGER ItemAvgRatingTrigger
AFTER INSERT OR UPDATE OF rating ON Collectionitems
REFERENCING NEW AS newRow
FOR EACH ROW
BEGIN
UPDATE Item
SET rating = (SELECT AVG(Collectionitems.rating) FROM Collectionitems, Item WHERE
Collectionitems.itemid = newRow.itemid AND newRow.itemid = Item.itemid)
WHERE Item.itemid = newRow.itemid;
END ItemAvgRatingTrigger;/
每当我通过更新 Collectionitems 中的一行来运行触发器时,我都会得到 squirrel 的返回:
Error: ORA-04098: trigger 'CA0513.ITEMAVGRATINGTRIGGER' is invalid and failed re-validation
SQLState: 42000
ErrorCode: 4098
Position: 7
执行SQL语句:
SELECT * FROM User_Errors;
产生 1 个错误:
PLS-00103: Encountered the symbol "/" The symbol "/" was ignored./n
我已经阅读了很多其他有同样问题的帖子,但还没有找到解决方案,有什么想法吗?