Mysql
 sql >> Base de données >  >> RDS >> Mysql

Impossible de créer MySQL TRIGGER lorsque j'utilise IS NOT NULL

Vous pouvez essayer ceci

delimiter //
CREATE TRIGGER b_I_O AFTER UPDATE ON book
FOR EACH ROW
BEGIN
    IF (OLD.status IS NOT NULL AND NEW.status IS NOT NULL AND NEW.status != OLD.status ) THEN
        INSERT INTO book_in_out (`astatus`, `bid`, `time`) VALUES(NEW.status, OLD.id, NOW());
    END IF;
END;//
delimiter ;