日期:2014-05-17 浏览次数:20614 次
create or replace trigger ab_delete
after delete on a
for each row
begin
delete from b where id = :old.id;
end;
create table roomname(room_name varchar(50) primary key )
create table classroom
(
room_name varchar(50) foreign key references roomname(room_name) on delete cascade --级联删除
)
insert into roomname
values('4101')
insert into classroom
values('4101')
go
--没有报错
delete roomname
where room_name = '4101'
--自动删除
select * from classroom