I am trying to build a trigger in MySQL that will run after new rows are inserted into a table. If there is an error detected, then I want to write that trigger to a table. Otherwise, I don't want to write the error to a table. I want to try and avoid adding endless blank rows.
Here is my code:
CREATE
TRIGGER character_validation4 AFTER INSERT
ON address FOR EACH ROW
Begin
IF(New.city REGEXP '^[^a-zA-Z0-9]')
THEN
INSERT INTO errorlog (city, mainprocessid) Values("There is an error with the city", New.ID));
END
But I am seeing an error on the final bracket.
Can anyone help? Thanks