此代码中的错误是什么创建触发器

时间:2017-04-12 10:13:36

标签: mysql

CREATE TRIGGER barcode1 BEFORE INSERT ON employeepc
FOR EACH ROW
BEGIN
    IF NEW.Barcode IS NULL THEN 
        SET NEW.REMAINING := NEW.employeeid;        
    END IF;
END;

1 个答案:

答案 0 :(得分:0)

DELIMITER $$

CREATE TRIGGER before_employee_update 
    BEFORE UPDATE ON employees
    FOR EACH ROW 
BEGIN
    INSERT INTO employees_audit
    SET action = 'update',
     employeeNumber = OLD.employeeNumber,
        lastname = OLD.lastname,
        changedat = NOW(); 
END$$

DELIMITER ;