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

Home -> Community -> Usenet -> c.d.o.misc -> problem with foreign key

problem with foreign key

From: Rüdiger J. Schulz <johannes.schulz_at_web.de>
Date: 08 Oct 2001 16:08:09 +0200
Message-ID: <3bc1b349$1@netnews.web.de>


hi all,

I have two tables:

CREATE TABLE PARENT (
   ID NUMBER NOT NULL,
   NAME VARCHAR2(100),
      CONSTRAINT PK_PARENT PRIMARY KEY(ID)    ) ;

CREATE TABLE CHILD (
   ID NUMBER NOT NULL,
   DT DATE DEFAULT sysdate NOT NULL,
   PID NUMBER NOT NULL,

      CONSTRAINT PK_CHILD PRIMARY KEY(ID), 
      CONSTRAINT FK_CHILD FOREIGN KEY(PID) 
         REFERENCES PARENT(ID) ON DELETE CASCADE);



transaction 1: delete a row in the parent table *without* a commit transaction 2: wants to insert a row in the CHILD-table

*problem*: transaction 2 wait until transaction 1 send a commit!!!

(rem: I have tested it without ON DELETE CASCADE and with ON DELETE SET NULL.)

is it true, that oracle lock the whole child-table, while deleting a parentkey ?
or can I do something else?

thanx in advance
Rüdiger

(eMail: rjs_at_berlin.de)

-- 
__________________________________________________________
News suchen, lesen, schreiben mit http://newsgroups.web.de
Received on Mon Oct 08 2001 - 09:08:09 CDT

Original text of this message

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