Mysql触发器
DROP TRIGGER IF EXISTS t_afterinsert_on_user; DELIMITER // CREATE TRIGGER t_afterinsert_on_user AFTER INSERT ON uam_user FOR EACH ROW BEGIN INSERT INTO uam_user_marked VALUES (UUID(),new. user_id , 1 , ' 35c6e621-d123-4af8-877d-dcd0b751dac9 ' , CURRENT_DATE ()); INSERT INTO uam_user_marked VALUES (UUID(),new. user_id , 1 , ' 648d7b62-2975-4853-bbcb-83bf5c06a8df ' , CURRENT_DATE ()); INSERT INTO uam_user_marked VALUES (UUID(),new. user_id , 1 , ' 699f9560-c956-44b8-8efb-920ead39c75e ' , CURRENT_DATE ()); INSERT INTO uam_user_marked VALUES (UUID(),new. user_id , 1 , ' 71cec5c1-d9d8-4e1e-a494-31718f07d563 ' , CURRENT_DATE ()); INSERT INTO uam_user_marked VALUES (UUID(),new. user_id , 1 , ' f7ceba1a-82e2-43af-a629-900832f4b8d9 ' , CURRENT_DATE ()); END ; // DELIMITER ;
PS:一定要注意 DELIMITER // END;// DELIMITER ;,不加这个执行时会有语法错误。