我有以下查询,
CREATE OR REPLACE TRIGGER display_salary_changes
BEFORE INSERT ON marks
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
DECLARE
sal_diff number;
BEGIN
sal_diff:=:NEW.sub1-:OLD.sub1;
dbms_output.put_line('Old salary: ' || :OLD.sub1);
dbms_output.put_line('New salary: ' || :NEW.sub1);
dbms_output.put_line('Salary difference: ' || sal_diff);
END;
当我尝试运行它时,
ORA-04098: trigger 'PRAS.B' is invalid and failed re-validation
名称类型序列行位置文本属性MESSAGE_NUMBER
B TRIGGER 1 9 38 PLS-00201: identifier 'OLD.SUB1' must be declared ERROR 201
B TRIGGER 2 9 2 PL/SQL: Statement ignored ERROR 0
B TRIGGER 3 10 41 PLS-00201: identifier 'NEW.SUB1' must be declared ERROR 201
B TRIGGER 4 10 2 PL/SQL: Statement ignored ERROR 0