2016-01-19 85 views
0
create or replace TRIGGER book_s_t3 
AFTER INSERT ON trans_s 
FOR EACH ROW 
begin 
    UPDATE book_s 
    SET no_of_books = :old.no_of_books + :new.no_of_books; 
    WHERE no_of_books = :new.no_of_books; 
end; 

添加收到错误为:递增值,如果书籍在图书馆管理系统

Compilation failed, line 3 (10:27:39) The line numbers associated with compilation errors are relative to the first BEGIN statement. This only affects the compilation of database triggers. 
PLS-00049: bad bind variable 'OLD.NO_OF_BOOKS'Compilation failed, line 3 (10:27:39) The line numbers associated with compilation errors are relative to the first BEGIN statement. This only affects the compilation of database triggers. 
PLS-00049: bad bind variable 'NEW.NO_OF_BOOKS'Compilation failed, line 4 (10:27:39) The line numbers associated with compilation errors are relative to the first BEGIN statement. This only affects the compilation of database triggers. 
PLS-00049: bad bind variable 'NEW.NO_OF_BOOKS'Compilation failed, line 4 (10:27:39) The line numbers associated with compilation errors are relative to the first BEGIN statement. This only affects the compilation of database triggers. 
PLS-00103: Encountered the symbol "WHERE" when expecting one of the following: (begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge 
+1

'old'和'new'代替':old'和':new' –

+0

和半结肠在'SET'线 – Nitish

回答

0

有它阻止你编译 触发语法错误的轿跑车。见下文片断

CREATE OR REPLACE TRIGGER book_s_t3 AFTER 
    INSERT ON trans_s FOR EACH ROW 
    DECLARE 
BEGIN 
    UPDATE book_s 
    SET no_of_books = :old.no_of_books + :new.no_of_books 
    WHERE no_of_books = :new.no_of_books; 
END;