Wednesday, September 23, 2009

Oracle Foreign Keys with NULLS

Here is a fact that even some experienced oracle developers don’t know. By definition a Primary Key – Foreign Key relationship means that all the values in child table’s Foreign Key column should exist in Parent Table’s Primary Key column. However, we ASSUME that since parent table can not have NULLs in Primary Key, child table also can not have NULLs in foreign key since. However this is not true. We can indeed have NULLs in foreign key on a table referring to a valid primary key in parent table.



Labels: ,

0 Comments:

Post a Comment

<< Home