create function selectData(hname varchar(30))
returns varchar(30)
begin
declare myresult varchar(30);
declare rscount int;
select count(*) into rscount from student where heroname=hname;
if rscount=0
then
set myresult='no';
else
set myresult='yes';
return myresult;
end if;
end
这样编写函数是通过编译了,但是调用这个函数:select selectData('dou');时却报了一个function ended without returns函数没有返回值的错误,不知道到底是什么缘故?
returns varchar(30)
begin
declare myresult varchar(30);
declare rscount int;
select count(*) into rscount from student where heroname=hname;
if rscount=0
then
set myresult='no';
else
set myresult='yes';
return myresult;
end if;
end
这样编写函数是通过编译了,但是调用这个函数:select selectData('dou');时却报了一个function ended without returns函数没有返回值的错误,不知道到底是什么缘故?
解决方案 »
- 如何通过命令将mysql3.0的数据库导入到5.0中,而5.0又导入到3.0中
- 系统重装,mysql怎样处理
- tomcat5.5+mysql连接池,来个实例!
- 怎么跳处WHILE呢?紧急
- 如何将MYSQL 数据库 转成 SQL SERVER数据库??
- 求MySql Cluster 7.2基准测试工具
- 请问,MySql中如何设置数据库的容量?
- 各位高手,求一个SQL 语句, 求救啊.... 我用的是MYSQL 4.0
- 我记得有一个mysql的管理工具phpmysql,可是我不知道怎么样使用,请指教!谢谢!
- TXT文本文件中的数据内容如何可以转换到MYSQL中?
- [求助]mysql字符+日期+4位流水号 这种数据怎么自动生成?
- 联表查询,使用函数,排序,导致查询变慢问题.
create function selectData(hname varchar(30))
returns varchar(30)
begin
declare myresult varchar(30);
set myresult='yes';
declare rscount int;
select count(*) into rscount from student where heroname=hname;
if rscount=0
then
set myresult='no';
end if;
return myresult;
end
end if;
return myresult;
returns varchar(30)
begin
declare myresult varchar(30);
declare rscount int;
select count(*) into rscount from student where heroname=hname;
if rscount=0
then
set myresult='no';
else
set myresult='yes'; end if; return myresult; end