PLIS中的ELSE IF条件不起作用

时间:2017-05-30 12:45:00

标签: oracle plsql

我正在撰写ELSE IF条件,但它无效。

IF P_TYPE='College' THEN      
  INSERT INTO SAPID_INPUTDATA_WIFI(BOCID,BUILDING_RJID,LOCATION_TYPE,TYPE)VALUES
  (P_BOCID,P_BUILDINGRJID,P_LOCATIONTYPE,P_TYPE) RETURNING ID INTO P_FLAG; 
  END IF;

ELSE IF P_TYPE='Public WiFi'  AND  P_LOCATIONTYPE ='Node BLDG'   THEN

  INSERT INTO 
  SAPID_INPUTDATA_WIFI(BUILDING_RJID,LOCATION_TYPE,TYPE)VALUES(P_BOCID,
  P_BUILDINGRJID,P_LOCATIONTYPE,P_TYPE) RETURNING ID INTO P_FLAG; 

END IF; 

1 个答案:

答案 0 :(得分:0)

主要问题是语法。试试这个:

IF P_TYPE='College' THEN      
  INSERT INTO SAPID_INPUTDATA_WIFI(
    BOCID,
    BUILDING_RJID,
    LOCATION_TYPE,
    TYPE)
  VALUES(
    P_BOCID,
    P_BUILDINGRJID,
    P_LOCATIONTYPE,
    P_TYPE)
  RETURNING ID INTO P_FLAG; 

ELSIF P_TYPE='Public WiFi' AND P_LOCATIONTYPE ='Node BLDG' THEN
  INSERT INTO SAPID_INPUTDATA_WIFI(
    BUILDING_RJID,
    LOCATION_TYPE,
    TYPE)
  VALUES(
    P_BOCID,
    P_BUILDINGRJID,
    P_LOCATIONTYPE,
    P_TYPE) 
   RETURNING ID INTO P_FLAG; 

END IF;