This is my first time using mysql and I am tying to learn how to use trigger.
Im using navicat, i go to table design and then go triggers tab. I create a trigger named testing and in definition I typed:
delimiter |
CREATE TRIGGER lpr.mytesting AFTER INSERT ON lpr.lpr_opt_upload
FOR EACH ROW BEGIN
set new.lpr_text := reverse(new.lpr_text);
END;
| delimiter ;
All im tying to do is whenever something new is inserted, I reverse the text in lpr_text field. However, i get "1064 - you have an error in your SQL; check the manual that corresponds o your MySql server version for the right syntax to yse 'ON lpr_opt_upload' FOR EACH ROW create trigger testing before insert on lpr_op' at line 1." I dont understand what Im doing wrong, I am just copying an trigger example.
//-------------------------------------------------------------------------//
I figured out the problem. I am using navicat and in navicat trigger tab, you only type the body into the definition, Not the header (ex: CREATE TRIGGER lpr.mytesting AFTER INSERT ON lpr.lpr_opt_upload). There are check box next to the name of your trigger and you use those instead of writing your own header.