Tuesday, 24 January 2017

[Maria/MySQL] Trigger If statement example

CREATE TRIGGER TRIGGER_TB_IOT_USER_01
    AFTER INSERT ON iot.TB_IOT_USER
    FOR EACH ROW
        BEGIN
            IF NEW.AUTH_CD = 'A' THEN
               INSERT INTO iot.TB_IOT_MCU_GROUP (MCU_GRP_NM, MCU_GRP_DESC, DEFAULT_YN, USER_ID, CREATED_DT, CREATED_NM, UPDATED_DT, UPDATED_NM) VALUES ('기본그룹', '기본그룹', 'Y', NEW.USER_ID, now(), NEW.USER_ID, now(), NEW.USER_ID);
            END IF;   
        END;

No comments:

Post a Comment