oracle 第 2 行的错误:PL/SQL:忽略语句
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23944060/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ERROR at line 2: PL/SQL: Statement ignored
提问by mdo smiley
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;
in oracle 10g i get this error message: ERROR at line 2: PL/SQL: Statement ignored
在 oracle 10g 中,我收到此错误消息:第 2 行出现错误:PL/SQL:语句被忽略
采纳答案by Roberto Navarro
You're missing a column name here "(name, surname, new_family_income)
", as you are trying to insert 4 values into 3 columns.. I switched the statement, to not list out the columns, maybe that will help..
您在此处缺少列名“ (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;