索引:: 1 Oracle中缺少IN或OUT参数

时间:2017-06-17 16:03:40

标签: oracle

运行这个小脚本时,我收到错误“在index :: 1处缺少IN或OUT参数”,不知道我在哪里犯错误/ s?

{
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;
}

1 个答案:

答案 0 :(得分: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;