delimiter Brief

MySql delimiter in the role:

Mysql interpreter to tell whether the segment command has ended, whether mysql to execute. 
By default, delimiter is a semicolon;. At the command line client, if there is a command line ends with a semicolon, mysql will execute the command (default mysql encountered a semicolon case, it will automatically execute).

example:

delimiter $$
create trigger userTest
AFTER UPDATE
on user for EACH ROW
BEGIN
UPDATE user_copy SET nuval=nuval+(new.nuval-old.nuval) where id=new.id;
UPDATE user_copytwo SET nuval=nuval+(new.nuval-old.nuval) where id=new.id;
END;$$
delimiter ;

 

Guess you like

Origin www.cnblogs.com/linxixinxiang/p/11205362.html
Recommended