今天做了一个小实验,发现
create table jl_1 (aa int primary key)
create table jl_2 (aa int primary key references jl_1(aa) on update cascade)
create table jl_2 (aa int primary key references jl_1(aa) on update cascade)
在sql Server2005中能够执行成功。在oracle中不能执行,报错。
SQL> create table jl_1 (aa int primary key);
表已创建。
SQL> create table jl_2 (aa int primary key references jl_1(aa) on update cascade);
create table jl_2 (aa int primary key references jl_1(aa) on update cascade)
*
第 1 行出现错误:
ORA-00905: 缺失关键字
create table jl_2 (aa int primary key references jl_1(aa) on update cascade)
*
第 1 行出现错误:
ORA-00905: 缺失关键字
如果把update改为delete,则执行成功。
SQL> create table jl_2 (aa int primary key references jl_1(aa) on delete cascade);
表已创建。
难道oracle不支持级联更新?后来查了一段资料,得出结果。
Many times we have the situation where a master table may be updated and dependent tables are left without a link back to the master. In this situation a cascade update option would be a nice one to have. Unfortunately Oracle Corp. doesn't provide this capability in a native manner so a PL/SQL option must be developed.
因此要级联更新只能使用触发器了!!!!
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25786698/viewspace-696548/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25786698/viewspace-696548/