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 constraint 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With