create or replace function testFunc(strTest varchar2) 
return  
is
  Result varchar(200) ;
begin
  select col1 into Result from testtable;
  return(Result)
end testFunc;

解决方案 »

  1.   

    create or replace function testFunc(strTest varchar2) return varchar2
    is
      Result varchar(200);
    begin
      Result := 'select * from testtable';
      return Result;
    end testFunc;
    /
      

  2.   

    用你的结果是这个:
    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)
      

  3.   

    1、函数必须有明确的返回值
    2、语句必须有分号结束
    3、return 语句不需要括号