2016-01-21 93 views
0

我有一個表OracleTimestamp字段,一個關鍵字段和2個其他列。我正在創建一個trigger,它將根據鍵和時間戳只更新另一個表,只顯示當前狀態行數據。新的觸發器,任何輸入和/或建議將不勝感激。Oracle觸發器以當前行狀態更新表

回答

1
create or replace TRIGGER A 
AFTER INSERT 
ON A1 
REFERENCING NEW AS New OLD AS Old 
FOR EACH ROW 

DECLARE 
BEGIN 

UPDATE C SET COLC=:new.colc, D=:new.cold, TIMESTAMP=:new.timestamp WHERE KEY=:new.key; 

EXCEPTION 
WHEN OTHERS THEN 
    -- Consider logging the error and then re-raise 
    RAISE; 
END A;