如果价格上涨超过 10%,这个触发器应该会抛出一个错误。出于某种原因,我收到 PLS-00103 错误。
CREATE OR REPLACE TRIGGER product_price_updt
BEFORE UPDATE ON PRODUCT
FOR EACH ROW
DECLARE
price_error VARCHAR2(100);
BEGIN
IF (:new.price > :old.price * 1.1) THEN raise price_error;
END IF;
EXCEPTION
when price_error then ('Price increase is greater than 10%, update cancelled');
END;
这是我编译时看到的。
Error(7,78): PLS-00103: Encountered the symbol ")" when expecting one of the following: * & = - + < / > at in is mod remainder not rem <an exponent (**)> <> or != or ~= >= <= <> and or like like2 like4 likec as between || multiset member submultiset
也许我的语法错误并且错误具有误导性。我无法找到问题所在。