开发者

Changing a FK delete rule in Oracle without dropping and recreating it?

Is there a way to change a table FK delete rule in Oracle better than dropping and then adding it again?

I'm currently using:

alter table A
drop constraint my_fk;

alter table A
add constrain开发者_Python百科t my_fk
foreign key (id)
references B(id)
ON DELETE SET NULL;

As you can see, I already have a FK constraint but it had no delete rule on it. I just want to add an ON DELETE SET NULL rule, and that's what I came up with so far, but I'm feeling it should be simpler.


No other way, except drop and re-create constraint. Oracle have syntax ALTER TABLE x MODIFY CONSTRAINT, but it can be used only for change state of constraint.

http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_3001.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜