Error creating a Trigger

0

I'm trying to create the following trigger:

DELIMITER //
CREATE TRIGGER 'smdraux_after_insert' AFTER INSERT ON 'smdraux' FOR EACH ROW BEGIN

IF(LENGTH(NEW.llamante) = (4) AND NEW.nombreinterlocutor1 NOT LIKE 'VM Channel%'
    AND NEW.nombreinterlocutor1 NOT LIKE 'U10%' AND NEW.nombreinterlocutor1 NOT LIKE 'Nuevo' 
    AND NEW.nombreinterlocutor1 NOT LIKE 'Elvira' AND NEW.nombreinterlocutor1 NOT LIKE 'Contact Center' 
    AND NEW.nombreinterlocutor1 NOT IN (SELECT nombreagente FROM agente)) THEN

    INSERT INTO agente(nombreagente, fechaderegistro)
    VALUES(NEW.nombreinterlocutor1, NOW());
END //

But I'm getting the error:

  

"# 1064 - Something is wrong in its syntax near 'END' on the line   10 "

Which is very ambiguous for me, which is the first time I work with triggers. I tried to put the expression "// DELIMITER;" after the 'END' but it sends me the same error.

    
asked by Nancy 02.01.2019 в 17:58
source

1 answer

1

The problem is that the conditional IF does not end with END IF; before END// .

Also:

  • Need LENGTH or CHAR_LENGTH ?.
  • Why do you use 'for text strings, would not it be, for example, 'U10%' instead of' U10% '?
answered by 03.01.2019 / 11:33
source