是否有可能在mysql中的插入事件之前添加更多作为触发器?
此刻我有:
DELIMITER ;;
CREATE TRIGGER before_insert_identityuser
BEFORE INSERT ON identityuser
FOR EACH ROW
BEGIN
IF new.Id IS NULL THEN
SET new.Id = uuid();
END IF;
END
;;
这将为表identityuser生成一个uuid。现在我想为表格声明生成第二个uuid。
也许是这样的:
DELIMITER ;;
CREATE TRIGGER before_insert_identityuser
BEFORE INSERT ON identityuser
FOR EACH ROW
BEGIN
IF new.Id IS NULL THEN
SET new.Id = uuid();
END IF;
END;
CREATE TRIGGER before_insert_claims
BEFORE INSERT ON claims
FOR EACH ROW
BEGIN
IF new.Id IS NULL THEN
SET new.Id = uuid();
END IF;
END;
;;
是否可以解决?