Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: existing FK, modify to add "ON DELETE CASCADE"

Re: existing FK, modify to add "ON DELETE CASCADE"

From: Marc Blum <blum_at_marcblum.de>
Date: Sat, 08 May 2004 18:10:36 +0200
Message-ID: <ob1q90d6svq25mnoaklvejk2emoj6vlvgh@4ax.com>


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.de
Received on Sat May 08 2004 - 11:10:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US