【发布时间】:2021-12-01 11:50:52
【问题描述】:
我在将存储过程应用到我的数据库时遇到问题。 在我的 order_table 中,我有以下属性 order_table(orderID、数量、价格、折扣)。 当数量超过 500 时,我需要将折扣值设置为“是”,并将价格设置为 15% 的折扣。 我试图使用以下语法使用触发器:
create trigger discount_t
before insert or update on order_table
for each row
begin
if quantity > 500
then (discount = 'Yes') and (price = price - ((price*15)/100);
end if;
end;
使用此语法时,我收到以下错误:
Errors: TRIGGER DISCOUNT_T
Line/Col: 3/15 PLS-00103: Encountered the symbol "=" when expecting one of the following:
:= . ( @ % ;
Line/Col: 3/59 PLS-00103: Encountered the symbol ";" when expecting one of the following:
) , * & - + / at mod remainder rem <an exponent (**)> and or
|| year day
我对 Oracle/Live SQL 不是很熟悉,所以有人知道我做错了什么吗?
【问题讨论】: