PL / SQL编译错误

时间:2017-04-05 07:43:09

标签: oracle plsql

CREATE OR REPLACE PROCEDURE Orden (n1 IN number, n2 IN number, n3 IN number) AS

    menor number;
        mediano number;
        mayor number;
    BEGIN
        IF (n1<n2) THEN 
            IF (n1<n3) THEN 
                menor := n1;
                IF (n2<n3) THEN
                    mediano := n2;
                    mayor := n3;
                ELSE 
                    mediano := n3;
                    mayor := n2;
                END IF;
            ELSE 
                menor := n3;
                mediano :=n1;
                mayor := n2;
            END IF;
        ELSE 
            IF (n1 < n3) THEN 
                menor := n2;
                mediano := n1;
                mayor := n3;
            ELSE 
                mayor := n1;
                IF(n2< n3) THEN 
                    medio := n2;
                    menor := n3;
                ELSE 
                    medio := n3;
                    menor := n2;
                END IF;
        END IF;
        n1 := menor;
        n2 := medio;
        n3 := mayor;                
    END;
/

错误是下一个:

  

39/5 PLS-00103:遇到符号“;”当期待其中一个   该        以下:        如果

1 个答案:

答案 0 :(得分:1)

三个问题:

  • 您错过了END IF
  • medio永远不会被宣布;也许你的意思是mediano
  • 如果您想为输入参数赋值,则需要IN OUT

提示:CASE可能是实现相同逻辑的更易读的方式。