使用触发器实现:删除dept对应的部门编号后,emp中部门编号变空
create or replace
trigger tri_change
after/*before instead of */ delete /* or update..*/ on dept
for each row --行级触发
--定义变量在这里 declare。。
begin
update emp set deptno=''
where deptno=:old.deptno;
--:new.字段表示新的 :old表示原来的
end;
本文介绍如何通过触发器实现删除部门后,员工表中对应部门编号自动变为空值,涉及数据库操作与触发器应用。
446

被折叠的 条评论
为什么被折叠?



