2017-06-17 92 views
0

當運行這個小腳本時,我收到錯誤「在index :: 1處缺少IN或OUT參數」不確定我在哪裏犯錯/ s?index:1缺少IN或OUT參數Oracle

{ 
DECLARE 
    LV_CODE_TXT VARCHAR (5) := 'A'; 
    LV_ORDERTOTAL_NUM NUMBER(6,2) := 100; 
    LV_DISCOUNT_NUM NUMBER(5,2); 
BEGIN 
    IF LV_CODE_TXT IN ('A','E') 
    THEN 
    LV_DISCOUNT_NUM =: LV_ORDERTOTAL_NUM * .05; 
    DBMS_OUPTUT.PUT_LINE (LV_DISCOUNT_NUM); 
    ELSIF LV_CODE_TXT IN ('B','C') 
    THEN 
    LV_DISCOUNT_NUM := LV_ORDERTOTAL_NUM * .10; 
    DBMS_OUTPUT.PUT_LINE (LV_DISCOUNT_NUM) 
    ELSIF LV_CODE_TXT = 'D' 
    THEN 
    LV_DISCOUNT_NUM := LV_ORDERTOTAL_NUM * .15; 
    DBMS_OUTPUT.PUT_LINE (LV_DISOCUNT_NUM); 
    ELSE 
    LV_DISOUNT_NUM := 0; 
    DBMS_OUTPUT.PUT_LINE(LV_DISOUNT_NUM); 
    END IF; 
END; 
} 
+0

這裏「DBMS_OUPTUT」 .PUT_LINE(LV_DISCOUNT_NUM ); –

+0

還不確定我需要改變什麼?我需要將DBMS_OUTPUT放在雙引號中嗎?我改變了局部變量的拼寫錯誤,但仍然無法工作。 – DKCroat

回答

1

你有幾個拼寫錯誤,語法錯誤,最重要的是你並不需要打開和關閉大括號({}),所以嘗試以下

DECLARE 
    LV_CODE_TXT   VARCHAR (5) := 'A'; 
    LV_ORDERTOTAL_NUM NUMBER (6, 2) := 100; 
    LV_DISCOUNT_NUM  NUMBER (5, 2); 
BEGIN 
    IF LV_CODE_TXT IN ('A', 'E') 
    THEN 
     LV_DISCOUNT_NUM := LV_ORDERTOTAL_NUM * .05; 
     DBMS_OUTPUT.PUT_LINE(LV_DISCOUNT_NUM); 
    ELSIF LV_CODE_TXT IN ('B', 'C') 
    THEN 
     LV_DISCOUNT_NUM := LV_ORDERTOTAL_NUM * .10; 
     DBMS_OUTPUT.PUT_LINE (LV_DISCOUNT_NUM); 
    ELSIF LV_CODE_TXT = 'D' 
    THEN 
     LV_DISCOUNT_NUM := LV_ORDERTOTAL_NUM * .15; 
     DBMS_OUTPUT.PUT_LINE (LV_DISCOUNT_NUM); 
    ELSE 
     LV_DISCOUNT_NUM := 0; 
     DBMS_OUTPUT.PUT_LINE (LV_DISCOUNT_NUM); 
    END IF; 
END; 
+0

非常感謝您在添加代碼時放置的{}括號。 – DKCroat

+0

@DKCroat不客氣。 – user75ponic

相關問題