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: Deletion

Re: Deletion

From: chensm <chensm_at_sesrcs1.src.se.bp.com>
Date: Fri, 25 Jun 1999 13:58:40 +0800
Message-ID: <7kv5fb$c22@eugwy1.bp.com>

I think maybe the problem comes from the deftree_c2. you can try to drop it and recreate without the "on delete cascade".

Joseph Kagume Ngari wrote in message <377178AC.E848087E_at_unbc.ca>...
>Hi and thanks for reading
>
>The table below is meant to represent a tree. HOwever, when i try and
>delete a record, it deletes all the records. I think it has to do with
>the flagrant use of ON DELETE CASCADE.
>Can you see any way for me to correct this problem.
>If a sibling is deleted, nothing else should be deleted.
>if a parent is deleted, all its children should be deleted.
>
>Thank you
>
>
>The table and its contraints are below
>
>
>CREATE TABLE deftree (
> project INTEGER NOT NULL,
> version INTEGER NOT NULL,
> id INTEGER NOT NULL,
> parent INTEGER,
> child INTEGER,
> sibling INTEGER,
> entry INTEGER NOT NULL,
> source INTEGER,
> sversion INTEGER,
> isnew INTEGER
>);
>
>ALTER TABLE deftree ADD CONSTRAINT deftree_c1
> PRIMARY KEY(project, version, id);
>
>ALTER TABLE deftree ADD CONSTRAINT deftree_c2
> FOREIGN KEY(project, version, parent)
> REFERENCES deftree(project, version, id)
> ON DELETE CASCADE;
>
>ALTER TABLE deftree ADD CONSTRAINT deftree_c3
> FOREIGN KEY(project, version, child)
> REFERENCES deftree(project, version, id)
> ON DELETE CASCADE;
>
>ALTER TABLE deftree ADD CONSTRAINT deftree_c4
> FOREIGN KEY(project, version, sibling)
> REFERENCES deftree(project, version, id)
> ON DELETE CASCADE;
>
>ALTER TABLE deftree ADD CONSTRAINT deftree_c5
> FOREIGN KEY(project, entry)
> REFERENCES deflist(project, id)
> ON DELETE CASCADE;
>
>ALTER TABLE deftree ADD CONSTRAINT deftree_c6
> FOREIGN KEY(project, sversion) REFERENCES versions(project, id)
> ON DELETE CASCADE;
>
>ALTER TABLE deftree ADD CONSTRAINT deftree_c7
> FOREIGN KEY(project, sversion, source)
> REFERENCES deftree(project, version, id)
> ON DELETE CASCADE;
>
Received on Fri Jun 25 1999 - 00:58:40 CDT

Original text of this message

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