主页 M

[范例、标准]oracle执行标准(1)外键

2014-05-31 网页编程网 网页编程网
create table test1(
id number(3),
num varchar2(5),
unique(id)
);
create table test2(
id number(3),
num varchar2(5),
unique(id),
CONSTRAINT test FOREIGN KEY (id) REFERENCES test1 (id) ON DELETE CASCADE
--不知为何不对CONSTRAINT test FOREIGN KEY (id) REFERENCES test1 (id) ON DELETE CASCADE ON UPDATE CASCADE
);
insert into test1 values (1,'123');
    insert into test2 values (1,'321');
        select * from test1
        delete from test1 where id=1
阅读原文
阅读 5580
123 显示电脑版