데이터베이스 트리거

3490 단어 데이터베이스
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 ;,이 실행을 추가하지 않을 때 문법 오류가 있을 수 있습니다.

좋은 웹페이지 즐겨찾기