第6行的SQL语法错误

时间:2014-08-18 14:00:29

标签: mysql sql triggers

create trigger ask before update on invoice
    -> for each row
    -> begin
    -> if(3<(select count(invoice_num) from invoice where customer_name=new.customer_name)) then
    -> set new.bill_amount=new.bill_amount-((5/100)*bill_amount);
    -> end;
    -> $$

1 个答案:

答案 0 :(得分:2)

proper syntax是:

if (condition) then
   ...
else
   ...
end if;
   ^^^----you're missing this bit