第2行的错误:PL / SQL:语句被忽略

时间:2014-05-29 22:26:44

标签: oracle plsql triggers

 CREATE OR REPLACE TRIGGER log_FAMILY_increase
  AFTER UPDATE OF FAMILY_INCOME ON STUDENT
  FOR EACH ROW
 BEGIN
   INSERT INTO STUDENT_2 (NAME, SURNAME, NEW_FAMILY_INCOME)
   VALUES (:NEW.NAME,SURNAME, :NEW.FAMILY_INCOME, 'New INCOME');
 END;

在oracle 10g中我收到此错误消息:    第2行的错误:PL / SQL:忽略语句

1 个答案:

答案 0 :(得分:2)

你在这里错过了一个列名“(name, surname, new_family_income)”,因为你试图将4个值插入3列。我切换了语句,没有列出列,也许这会有所帮助..

CREATE OR REPLACE TRIGGER log_family_increase
   AFTER UPDATE OF family_income
   ON student
   REFERENCING NEW AS new OLD AS old
   FOR EACH ROW
BEGIN
   INSERT INTO student_2 
        VALUES (:new.name,
                :new.surname,
                :new.family_income,
                'New INCOME');
END;