我在joomla数据库(表_users)上创建了AFTER INSERT触发器,该数据库在注册后将user_id和名称复制到另一个表。
一切正常,直到注册过程中有人输入已经存在的名称为止,否则列名称不是主要名称或唯一名称。我收到错误消息:
Save failed with the following error: Result consisted of more than one row
我的触发器如下:
BEGIN
DECLARE `new_user` integer;
DECLARE `new_name` VARCHAR(400);
SELECT `id`
INTO `new_user`
FROM `eio3k_users`
WHERE `id` = NEW.id;
SELECT `name`
INTO `new_name`
FROM `eio3k_users`
WHERE `name` = NEW.name;
INSERT INTO `eio3k_point_system`(`user_id`, `name` ) VALUES (NEW.id, NEW.name);
END
该如何避免该错误?