db2触发器after insert中如何取得插入前的数据?以前ORACLE里面
CREATE OR REPLACE TRIGGER "BRAS".trig_arc_mime_table
AFTER UPDATE OR DELETE OR INSERT ON ARC_MIME_TABLE
FOR EACH ROW
BEGIN
IF INSERTING THEN
DELETE SYS_DATA_DICT
WHERE dict_type='509'
AND dict_code=:NEW.file_extension;
INSERT INTO SYS_DATA_DICT(id,dict_type,dict_code,dict_name,view_index,remark)
VALUES (seq_sys_data_dict.nextval,509,:NEW.file_extension, :NEW.file_type, :NEW.id,'文件类型');
END IF;
IF UPDATING THEN
UPDATE SYS_DATA_DICT s
SET s.dict_code=:NEW.FILE_EXTENSION,
s.dict_name=:NEW.file_type
WHERE s.dict_type=509
AND s.dict_code=:OLD.FILE_EXTENSION;
END IF;
IF DELETING THEN
DELETE FROM SYS_DATA_DICT
WHERE dict_type=509
AND dict_code=:OLD.file_extension;
END IF;
END;
现在问题是,DB2中AFTER INSERT 中好象取不到old的数据,这个有没有好办法啊?谢谢大家了。
------解决方案--------------------------------------------------------
create trigger trig_emp_del
BEFORE DELETE ON emp
REFERENCING OLD AS o
FOR EACH ROW MODE DB2SQL
。。。。。
通过O不能得到?
------解决方案--------------------------------------------------------
INSERT 之前哪来的数据呢?
update 会有 old , new
delete 只有 old
insert 只有 new