Mysql if 语句不起作用

阿尤布·埃尔·阿巴西

我正在尝试将存储过程添加到 Mysql 中,但总是在第 6 行显示错误 请帮助我解决此问题。

create procedure User_Sync_Proc(in ID int,in Matricule int,in Type_OP nvarchar(50))
begin
    if (select current_user()='root@localhost')
    then
        insert into user_sync values(ID,Matricule,Type_OP,Now());
    end if;
end
鲑鱼

您可能只需要设置分隔符

drop procedure if  exists User_Sync_Proc;

delimiter $$

create procedure User_Sync_Proc(in ID int,in Matricule int,in Type_OP nvarchar(50))
begin
    if (select current_user()='root@localhost')
    then
        insert into user_sync values(ID,Matricule,Type_OP,Now());
    end if;
end $$

delimiter ;

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章