为什么mysql触发器不起作用?

时间:2013-10-02 20:57:28

标签: mysql triggers hive

这是触发器。

BEGIN
DECLARE x INT;
DECLARE y varchar(50);
DECLARE model varchar(50);
DECLARE Inventory longtext;

SET x = (SELECT `PlayerUID` FROM `cust_spawn` WHERE `PlayerUID`=NEW.PlayerUID);
SET y = (SELECT `Worldspace` FROM `cust_spawn` WHERE `PlayerUID`=NEW.PlayerUID);
SET model = (SELECT `Model` FROM `cust_spawn` WHERE `PlayerUID`=NEW.PlayerUID);
SET Inventory = (SELECT `Inventory` FROM `cust_spawn` WHERE `PlayerUID`=NEW.PlayerUID);
IF NEW.PlayerUID = x THEN
IF NEW.Worldspace != NULL THEN
SET NEW.Worldspace = y;
END IF;
IF Inventory != NULL THEN
SET NEW.Inventory=Inventory;
END IF;
IF model != NULL THEN
SET NEW.Model=model;
END IF;
END IF;
END

这是两个表的结构。 cust_spawn http://clip2net.com/s/5SfUtR

和“目的地”表。字符数据http://clip2net.com/s/5SfTvg

0 个答案:

没有答案