月当空
2015-07-15 00:14
比如一个员工被开除,需要在另一张表添加开除人和开出时间。怎么创建触发器?
create table delemp(name varchar(20) , deldate date) create or replace trigger delemp_tri after delete on emp for each row beagin insert into delemp values(:old.ename, select sysdate from dual); end; /
create table del_table(delname varchar(20) , deldate date)
create or replace trigger del_tri
after delete
on emp
for each row
beagin
insert into del_table values(select user from dual , select sysdate from dual);
end;
create table dele(dname varchar2(20),dtime date)
create or replace trigger beigen
after delete
on emp
for each row
begin
insert into dele values(:old.ename,sysdate);
end;
添加开除时间和开除人比较好实现,sql语句就行了。现在是想想你的触发条件,员工被开除是哪个表受影响,是否符合触发器的触发条件。
Oracle触发器
36895 学习 · 49 问题
相似问题