MySQL存储过程;多法案程序,抛出错误

时间:2016-04-23 05:43:05

标签: mysql stored-procedures

{{1}}

当我尝试使用phpMyAdmin将其放入存储过程时,上面会抛出错误。它说第二个语句开始后我的语法就出错了。

Attached is a screenshot of the erroer

1 个答案:

答案 0 :(得分:0)

从删除查询中删除*。然后它就能正常运行

CREATE  PROCEDURE `sp_test`()
Begin
      UPDATE Decks 
      JOIN Amount ON amount.DeckName = decks.DeckName 
      SET decks.DeckTotal = Decks.DeckTotal - Decks.DeckTotal
      WHERE Amount.AmountName =1;

      UPDATE Types t1
      JOIN Cards ON cards.TypeName = t1.TypeName 
      JOIN Amount ON amount.CardName = Cards.CardName
      SET t1.TypeTotal = t1.TypeTotal - Amount.Amount
      WHERE Amount.CardName = @aName;

      DELETE 
      FROM Amount 
      WHERE CardName = @aName;
 end