更新时间:2023-11-27 23:22:28
您的格式已关闭,请记住需要DELIMITER $$
语句,因为它与创建存储过程没有什么不同.
Your Formatting is off, remember DELIMITER $$
statements are required, as it is no different than creating a stored procedure.
向下滚动文档约一半以查看示例.
Scroll about half way down the documents to see the example.
但是,这就是您要寻找的:
But, This is what your looking for:
DELIMITER $$
CREATE TRIGGER tg_newuser_insert
BEFORE UPDATE ON tbl_newuser
FOR EACH ROW
BEGIN
SET NEW.id = CONCAT('YTUM', LPAD(LAST_INSERT_ID(), 8, '00000'));
END $$
DELIMITER ;