当前位置:主页 >> Oracle >> 正文
[范例、标准]oracle执行标准(1)外键
阅读:1077 输入:2014-05-31 02:18:16
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