函数问题!看看那里不对

zhytalent 2006-03-17 10:27:44
create or replace function testFunc(strTest varchar2)
return
is
Result varchar(200) ;
begin
Result := 'select * from testtable'
return(Result);
end testFunc;



pl/sql报错:
FUNCTION DBO_LZ2.TESTFUNC 编译错误

错误:PLS-00103: 出现符号 "RESULT"在需要下列之一时:
<an identifier>
<a double-quoted delimited-identifier>LONG_doublerefchartime
timestampintervaldatebinarynationalcharacternchar
符号 "<an identifier>" 被替换为 "RESULT" 后继续。
行:3
文本:is

错误:PLS-00103: 出现符号 "RETURN"在需要下列之一时:
.(*@%&=-+;</>atinmodnot
rem<an exponent (**)><> or != or ~=>=<=<>andorlikebetween
is nullis not||is dangling
符号 "." 被替换为 "RETURN" 后继续。
行:7
文本:return(Result);

错误:提示: Parameter 'strTest' 已被声明但从来没有被用于 'testFunc'
行:1
文本:create or replace function testFunc(strTest varchar2)



语法不对?
...全文
103 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhytalent 2006-03-17
  • 打赏
  • 举报
回复
谢谢,解贴,散分!
boydgmx 2006-03-17
  • 打赏
  • 举报
回复
1、函数必须有明确的返回值
2、语句必须有分号结束
3、return 语句不需要括号
zhytalent 2006-03-17
  • 打赏
  • 举报
回复
用你的结果是这个:
FUNCTION DBO_LZ2.TESTFUNC 编译错误

错误:PLS-00103: 出现符号 "RESULT"在需要下列之一时:
<an identifier>
<a double-quoted delimited-identifier>LONG_doublerefchartime
timestampintervaldatebinarynationalcharacternchar
符号 "<an identifier>" 被替换为 "RESULT" 后继续。
行:3
文本:is

错误:PLS-00103: 出现符号 "END"在需要下列之一时:
*&=-+;</>atinmodnotrem
<an exponent (**)><> or != or ~=>=<=<>andorlikebetween
overlapsis nullis not||is danglingyearDAY_
符号 ";" 被替换为 "END" 后继续。
行:8
文本:end testFunc;

错误:提示: Parameter 'strTest' 已被声明但从来没有被用于 'testFunc'
行:1
文本:create or replace function testFunc(strTest varchar2)
boydgmx 2006-03-17
  • 打赏
  • 举报
回复
create or replace function testFunc(strTest varchar2) return varchar2
is
Result varchar(200);
begin
Result := 'select * from testtable';
return Result;
end testFunc;
/
xluzhong 2006-03-17
  • 打赏
  • 举报
回复
create or replace function testFunc(strTest varchar2)
return
is
Result varchar(200) ;
begin
select col1 into Result from testtable;
return(Result)
end testFunc;

17,382

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧