sql >> Base de Datos >  >> RDS >> Mysql

No puedo crear MySQL TRIGGER cuando uso IS NOT NULL

Puedes probar esto

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 ;