我翻阅官方文件。和现有的线程但无法确定何时执行以下触发器:
CREATE OR REPLACE TRIGGER TRIG_TS_TRANSPORT_AFTER
AFTER INSERT OR
UPDATE OF iud, addressid, idd, rld, pickupaddressid, vessel
ON chassitransports
REFERENCING NEW AS new OLD AS old
FOR EACH ROW
.
.
.
由于更新是从外部数据库发生的,我无法测试上述情况:|
答案 0 :(得分:0)
它应该在行的INSERT之后或在任何提到的列的UPDATE之后触发。见下面的例子:
---- Create sample Tables
CREATE TABLE temptable1 (regNo VARCHAR2(20), timec TIMESTAMP(6));
create table TEMPTABLE2
(
idx NUMBER,
regno VARCHAR2(20),
eventb VARCHAR2(20),
timec DATE,
rfid NUMBER
);
----- Trigger definition
CREATE OR REPLACE TRIGGER after_update_tr
AFTER UPDATE OF timec, regNo ON temptable2
FOR EACH ROW
BEGIN
INSERT INTO temptable1
VALUES(:NEW.regNo,
:NEW.timec);
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line(sqlerrm);
END;
------ Fire update statement ----
UPDATE temptable2
SET regNo = 'VISIT0000011'
WHERE timec IS NULL;
并成功执行。