Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Kann MySQL TRIGGER nicht erstellen, wenn ich IS NOT NULL verwende

Sie können dies versuchen

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 ;