0
我正在寫一個觸發器,它將觸發更新並插入到一個表上並插入到另一個表中。觸發器看起來像這樣。觸發器沒有觸發使用引用
create or replace trigger update_test_history
before insert or update on demo.test_req REFERENCING NEW AS NEW OLD AS old
for each row
declare
v_count number(1);
begin
if :old.quote_request_id != null then
--Update History table
insert into demo.test_req_history
(history_id,
req_id)
values
(isisdba.req_hist_seq.nextval,
:old.req_id);
end if;
end update_test_history;
此觸發器不適用於DML。但是,如果我刪除if條件,那麼它開始工作。 有人可以告訴我這是什麼錯誤。 在此先感謝。
定義「不工作」? 'null'永遠不會等於任何包含'null'的值。 'null'也永遠不等於另一個包括'null'的值。所以'something!= null'永遠不會計算爲'true'。也許你想要':old.quote_request_id不爲空'。 –
謝謝Jastin,它正在工作。 –