Answer the question
In order to leave comments, you need to log in
Why doesn't the trigger fire as intended?
There is a table notify_text (guild_id, role_id, member_id, text). I want to implement an automatic check that role_id and member_id will not be added to the database at the same time.
I tried to implement a trigger, but it only skips the option when role_id = null and member_id = null. What needs to be corrected? What am I doing wrong?
DELIMITER //
CREATE TRIGGER notify_target_check BEFORE INSERT ON notify_text
FOR EACH ROW
BEGIN
IF NEW.role_id IS NOT NULL AND NEW. member_id IS NOT NULL THEN
INSERT INTO 'role_id и member_id не могут быть заполнены одновременно' VALUES(5);
END IF;
END//
DELIMITER ;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question