definer定义在trigger中使用的权限
create definer=`` trigger `触发器名 ` before insert ON `触发表名 ` FOR EACHROW BEGIN
/*定义变量*/
Declareid VARCHAR(255);
Declaren,m int;
Declaret DATETIME;
DeclareDoneintDEFAULT0;
Declareresult cursor for SELECT l.id FROM table;
/*循环*/
open result;
flag_while:whileDone=0 do
fetch result into id;
End while flag_while;
close resultlow;
/*判断*/
If()
Then
执行SQL或内容;
End if;
End
substring_index(“待截取字符串”,“截取数据依据的字符”,截取字符的位置N)(N为-1倒数第一个)
char_length()字符串长度