ORA-00911:在插入触发器之前创建时无效字符

时间:2017-02-28 10:11:26

标签: oracle plsql

我使用以下代码

插入前创建了一个以下触发器
CREATE or REPLACE TRIGGER TR_UPDATE_FR_LOGTYPE
    BEFORE INSERT
ON LOGSAPDEALSLIPFUNDREQINTGRTN
    REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW  
    BEGIN
      IF (:NEW.RESPONSESTRING IN ('Record already exists') and  :NEW.LOGTYPE='ServiceFault') THEN
              :NEW.LOGTYPE :='Success';  
       END IF;  

         IF (:NEW.RESPONSESTRING is null and  :NEW.LOGTYPE is null and :NEW.STATUS is null) THEN
              :NEW.STATUS :='T';
         END IF;
          IF (:NEW.RESPONSESTRING <> null and  :NEW.LOGTYPE='Other') THEN
             :NEW.STATUS :='S';
         END IF;
         IF (:NEW.RESPONSESTRING <> null and  :NEW.LOGTYPE is null and :NEW.STATUS is null) THEN
         :NEW.STATUS :='S';
          END IF; 
END TR_UPDATE_FR_LOGTYPE;
END

但是错误是

  

ora 09111无效字符

1 个答案:

答案 0 :(得分:1)

我认为必须简单地删除最后一个END:

/* Formatted on 28/02/2017 11:13:38 (QP5 v5.136.908.31019) */
CREATE OR REPLACE TRIGGER TR_UPDATE_FR_LOGTYPE
   BEFORE INSERT
   ON LOGSAPDEALSLIPFUNDREQINTGRTN
   REFERENCING NEW AS NEW OLD AS OLD
   FOR EACH ROW
BEGIN
   IF (:NEW.RESPONSESTRING IN ('Record already exists')
       AND:NEW.LOGTYPE = 'ServiceFault')
   THEN
      :NEW.LOGTYPE := 'Success';
   END IF;

   IF (    :NEW.RESPONSESTRING IS NULL
       AND:NEW.LOGTYPE IS NULL
       AND:NEW.STATUS IS NULL)
   THEN
      :NEW.STATUS := 'T';
   END IF;

   IF (:NEW.RESPONSESTRING IS NOT NULL AND :NEW.LOGTYPE = 'Other')
   THEN
      :NEW.STATUS := 'S';
   END IF;

   IF (    :NEW.RESPONSESTRING IS NOT NULL
       AND:NEW.LOGTYPE IS NULL
       AND:NEW.STATUS IS NULL)
   THEN
      :NEW.STATUS := 'S';
   END IF;
END TR_UPDATE_FR_LOGTYPE;