I added a field to my users table, the field name is uuid, and I want to create a trigger that activates on insert and set the uuid value for that new inserted record to the function UUID(). I tried this, but no success
CREATE TRIGGER uuid_users_insert BEFORE INSERT ON `users`
FOR EACH ROW
BEGIN
SET NEW.uuid = UUID();
END
;
I get this error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 4
Any idea?
Use of multiple statements requires that a client is able to send statement strings containing the ; statement delimiter. This is handled in the mysql command-line client with the delimiter command. Changing the ; end-of-statement delimiter (for example, to //) allows ; to be used in a routine body. For an example, see Section 18.2.1, “CREATE PROCEDURE and CREATE FUNCTION Syntax”.