Trigger in MYSQL (Insert)

0

I'm trying to create a trigger in MYSQL. I was reading the documentation of MYSQL, some examples that I saw out there on the internet and, at the moment of truth (adding it to the console) marks me a syntax error. I do not know what it can be, according to me "it's right". The trigger is as follows:

CREATE TRIGGER inSucursal AFERT INSERT ON Sucursal
FOR EACH ROW
BEGIN
    IF NEW.area = 'Norte'
    INSERT INTO sucursalNorte(numeroSucursal, area, direccion)
    VALUES(new.numeroSucursal, new.area, new.direccion)
    END IF;
    IF NEW.area = 'Centro'
    INSERT INTO sucursalCentro(numeroSucursal, area, direccion)
    VALUES(new.numeroSucursal, new.area, new.direccion)
    END IF;
    IF NEW.area = 'Sur'
    INSERT INTO sucursalSur(numeroSucursal, area, direccion)
    VALUES(new.numeroSucursal, new.area, new.direccion)
    END IF;
    END;

The detail is that I have a syntax error in the "INSERT INTO" line. I've been looking everywhere and I have not solved it.

    
asked by Edgar Gc 11.06.2018 в 01:25
source

0 answers