求解决mysql创建函数的语法问题
delimiter //
create function getadminname(user varchar(32))
RETURNS CHAR(50)
BEGIN
declare type int(11) default 0;
declare countryid int(11) default 0;
set type =(select type from db1.user_account where user='user');
if exists (select name from db2.country_info where id=(select id from dbpushmail.id_info where user=user)
set countryid =(select channel from db1.id_info where user=user);
return (select Name from db1.name_info where type = type and countryid = countryid );
END
//
这个语法,我Google了一下,没有找到比较全面的语法规则。
试着写了一下,发现在if exists 下面一行提示错误。
请问具体要怎么改呢?