Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: existing FK, modify to add "ON DELETE CASCADE"
On Sat, 08 May 2004 08:26:55 -0700, "Anna C. Dent" <anacedent_at_hotmail.com>
wrote:
>What is the proper SQL syntax to modify an EXISTING
>foreign key constraint to add "ON DELETE CASCADE" to it?
sorrily you have to drop it:
ALTER TABLE t
DROP CONSTRAINT fk;
ALTER TABLE t
ADD CONSTRAINT fk
FOREIGN KEY (some_column)
REFERENCES some_table
ON DELETE CASCADE
NOVALIDATE;
you may use NOVALIDATE, because the fk was in place before, so you may avoid the
overhead of validating current data
-- Marc Blum mailto:blumNOSPAM_at_marcblum.de http://www.marcblum.deReceived on Sat May 08 2004 - 11:10:36 CDT