日期:2014-05-17 浏览次数:20939 次
create table table1
(
SID varchar2(20),
t1 number,
t2 number,
t3 number
);
create table table2
(
TID number
);
insert into table1
values('A',1,3,5);
insert into table1
values('B',5,5,9);
insert into table1
values('C',5,7,11);
select * from table1;
insert into table2
values(1);
insert into table2
values(3);
insert into table2
values(5);
insert into table2
values(7);
insert into table2
values(9);
insert into table2
values(11);
CREATE OR REPLACE TRIGGER del_on_table2 before
DELETE ON table2 FOR EACH row DECLARE v_tid NUMBER;
BEGIN
v_tid:= :OLD.TID;
UPDATE table1
SET t1= DECODE(t1, v_tid ,0,t1),
t2 = DECODE(t2,v_tid,0,t2),
&