0
如果價格上漲超過10%,該觸發器應該會引發錯誤。出於某種原因,我收到PLS-00103錯誤。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
也許我的語法錯了,錯誤是誤導。我無法找到問題。
啊,我遇到了一些老的教程,他們宣佈異常爲varchar2。非常感謝,就是這樣! – user1729696
這些教程可能一直在使用RAISE_APPLICATION_ERROR過程來引發異常。我建議你在文檔中找到並閱讀它。分享並享受。 –