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

Home -> Community -> Mailing Lists -> Oracle-L -> Data modeling question

Data modeling question

From: <Rick_Cale_at_teamhealth.com>
Date: Wed, 30 Oct 2002 08:08:43 -0800
Message-ID: <F001.004F7803.20021030080843@fatcity.com>


I was reading one of the papers on the quest website about data modeling. An example was presented and I did not believe the results so I tried it out. Of course the writer ( Phd) was correct.

Does anyone know why does not enforce RI constraint if any of the foreign key colums are NULL. I took it literally that if I insert any record in table_2 that a corresponding record must be in the parent(table_1). Apparently this is not so. Someone please explain.

Thanks
Rick

drop table table_2;
drop table table_1;

create table table_1 (
  a number not null,
  b number not null,
  c number,
 constraint table_1_pk primary key (a,b));

create table table_2 (
a number,
b number,
d number not null,
e number not null,
f number,
constraint pk_table_2 primary key (d,e), constraint fk_table_2_reference_table_1 foreign key (a,b) references table_1 (a,b))
/

insert into table_2 values(1,NULL,3,4,5);

1 row processed.

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: Rick_Cale_at_teamhealth.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Wed Oct 30 2002 - 10:08:43 CST

Original text of this message

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