0
delimiter ||
create trigger bins_chk
before insert on VEHICLE
on each row
begin
\t if (new.`Vehicle_type`= 'car') then
\t \t if (new.`Tonnage` != null or new.`No_Seats` <> null) then
\t \t \t signal sqlstate "45000"
\t \t \t \t set message_text "Do not match!";
\t elseif new.`Vehicle_type`= 'suv' then
\t \t if new.`Tonnage`<>null or new.`Engine_size`<>null then
\t \t \t signal sqlstate "45000"
\t \t \t \t set message_text "Do not match!";
\t elseif new.`Vehicle_type`= 'truck' then
\t \t if new.`Engine_size`<>null or new.`No_Seats`<>null then
\t \t \t signal sqlstate "45000"
\t \t \t \t set message_text "Do not match!";
\t end if;
end ||
delimiter;
哪裏出了問題,我只是不知道如何解決它。
錯誤1064(42000):您的SQL語法錯誤;檢查對應於你的MySQL服務器版本的權利 語法上的每一行使用近」的 手動開始是否有新的。
Vehicle_type = 'car'
那麼如果新。Tonnage <> null
「在3線
對於每一行不是在每行 –
BUG! '<> null'不會做你的想法。更改爲'IS NOT NULL'。 –