create or replace trigger trans_s_t5
after insert
on trans_s
for each row
begin
update :old.no_of_books
set book_no=:old.no_of_books+1
where book_no=:trans_s.book_no;
end;
将错误视为:
PLS-00049: bad bind variable 'OLD.NO_OF_BOOKS' Compilation failed, line 3
PLS-00049: bad bind variable 'OLD.NO_OF_BOOKS' Compilation failed, line 4
PLS-00049: bad bind variable 'TRANS_S.BOOK_NO' Compilation failed, line 2
PL/SQL: ORA-00903: invalid table name Compilation failed, line 2 (10:11:17)
PL/SQL: SQL Statement ignored
答案 0 :(得分:0)
您似乎正在尝试更改此触发器中TRANS_S表中字段的值,该触发器在TRANS_S表上定义。如果是这样,您可以通过将触发器更改为BEFORE触发器并直接更新字段来实现此目的,如:
create or replace trigger trans_s_t5
BEFORE insert on trans_s
for each row
begin
:NEW.NO_OF_BOOKS := :NEW.NO_OF_BOOKS + 1;
end;
祝你好运。