0
這是我寫的觸發器。mysql:觸發器中的ERROR 1064(42000)
DELIMITER //
create trigger after_insert_bid
after insert on Bid
for each row
when exists(
select *
from Item
where ItemID = new.ItemID)
begin
update Item set Item.currently = NEW.amount where Item.itemID = NEW.itemID;
end;//
DELIMITER ;
它有一個錯誤:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'when exists(
SELECT *
FROM Item
WHERE ItemID = new.ItemID
)
begin
UPDATE Item SE' at line 4
mysql> end;
我是新來的MySQL,我知道這是一個簡單的問題,但我真的不知道如何找到錯誤,謝謝!
MySQL的版本是73年5月1日
您發現了錯誤。你是否檢查了手冊中的語法與指定的內容? – tadman
我的版本是mysql 5.1.73。我試過在手冊中發現它,但它沒有工作.sorry –
你不能在那裏做一個'WHEN EXISTS',所以你需要一個不同的方法。看看有哪些* trigger_event *類型。 – tadman