首页 文章

ORA-06550:PLS-00103:遇到符号“;”

提问于
浏览
-3

ORA-06550:第20行,第4栏:PLS-00103:遇到符号“;”当期待以下之一时:

如果1.声明2.一个数字; 3. b号;

4. c号;

declare
a number;
b number;
c number;
d number;

function findMaxOfAll(x in number, y in number, z in number)
return number
is
m number;
begin
  if x > y and x > z then
    m:=x;
     else if y > x and y > z then
       m:=y;
        else
          m:=z;
  end if;
  return m;
end;

begin
a:=34;
b:=76;
c:=56;
d:=findMaxOfAll(a, b, c);
dbms_output.put_line('Max of all is: ' || d);
end;

2 回答

  • 3

    麻烦在于 ELSE IF .

    将其更改为 ELSIF .

    if x > y and x > z then
        m:=x;
         elsif y > x and y > z then
           m:=y;
            else
              m:=z;
      end if;
    
  • 3

    我不理解这个片段的使用,因为oracle已经提供了GREATEST函数来执行这种类型的操作 . 这些更易于使用和优化 . 希望这可以帮助 .

    SELECT greatest('&x','&y','&z') FROM dual;
    

相关问题