我試圖執行在MySQL觸發下面的語句(通過phpmyadmin)錯誤在MySQL
FOR EACH ROW BEGIN
DELETE from balancetable WHERE triggeredby="salesinvoices" AND invoiceNumber=NEW.invoiceNumber;
INSERT INTO balancetable SET invoiceNumber=NEW.invoiceNumber,ledgerId=NEW.buyerId,date=NEW.invoiceDate,company=NEW.companyId,type="debit",triggeredby="salesinvoices";
END;
我收到此錯誤觸發聲明:
MySQL said: #1064 - 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 'FOR EACH ROW BEGIN DELETE from balancetable WHERE triggeredby="salesinvoices" A' at line 1
我一直在敲打我的頭從最後一刻開始。指出我的愚蠢PLS :)
既然你已經找到了你的問題的解決方案張貼作爲一個答案這樣別人才能受益。 – peterm