测试从一个表中提取出不重复得名字个数,建立的函数执行一直报错,求解
函数:
create function nameNum() returns int
begin
declare a int;
select count(distinct name) from score into a;
return a;
end;
报错:/* SQL错误(1064):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 'return a' at line 1 */