--原始表emp與備份表emp_c的同步
create?or?replace?trigger?bfemp01
after?update?or?delete?or?insert
on?emp
for?each?row
declare
begin
?if?updating?then
??update?emp_c?set?emp_sal_?=?:new.emp_sal_,TABLE_STATE_='update',DATA_VERSION=DATA_VERSION+1
??where?emp_id_?=?:old.emp_id_;
??dbms_output.put_line('更新成功!');
?end?if;
?if?deleting?then
??delete?from?emp_c?where?emp_id_=?:old.emp_id_;
??dbms_output.put_line('刪除成功!');
?end?if;
?if?inserting?then
??insert?into?emp_c?values(:new.dept_id_,:new.dept_name_,
??:new.emp_id_,:new.emp_name_,:new.emp_sex_,:new.emp_sal_,
??:new.emp_comm_,:new.emp_posi_,'insert',0);
??dbms_output.put_line('新增成功!');
?end?if;
end;
/
- 0 回答
- 0 關(guān)注
- 1547 瀏覽
添加回答
舉報(bào)
0/150
提交
取消