SQL自定函数(遇到的坑) 细节一: 传进来的参数名字不能和字段名字一样 细节二: 起别名 查询语句 select get_host() as host 以下是自定义函数模板 delimiter // create function getName(name VARCHAR(255)) returns text begin declare result text; SELECT host INTO result FROM web_host_table WHERE web_name = webName LIMIT 1; return result; end// delimiter;