Forum Stats

  • 3,733,982 Users
  • 2,246,853 Discussions
  • 7,856,964 Comments

Discussions

How is parent child relationship established in case of null values in a foreign key of child table

Gaurav R
Gaurav R Member Posts: 23
edited May 2015 in SQL


Hi All,
Need your help. I came across a scenario for a foreign key  which I am confused with .Please help.

-- A master table created
create table master1
(
k number unique
);

-- A child table created
create table child1
(
k1 number ,
constraint ka foreign key (k1) references  u(k)
);

-- Insert of some values into master having two nulls
insert into master1 values (1);
insert into master1 values (null);
insert into master1 values (null);

-- Insert of some values into child having two nulls
insert into child1 values (null);
insert into child1 values (null);


Now, In this case these two null values in child are pointing to which null value in the master table .how does oracle handles this case ?
How is parent child relationship established in case of null values in a foreign key of child table ?

Tagged:
Sign In or Register to comment.