Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"small doubt on insertion of null value in child table"

Status
Not open for further replies.

vasukona

Programmer
Jul 26, 2003
2
IN
HI..
RECENTLY I SAW THIS SITE..AND IAM VERY MUCH IMPRESSED WITH THE WORK.
IAM LEARNING DB2 NOW . I WANT TO ASK ONE DOUBT.PLS CLARRIFY ANYONE.
" WHEN WE ENTER VALUES IN A FOREIGN KEY FIELD(ASSUME IT BEING NULLABLE) FIRST IT SHOULD CHECK THE EXISTENCE OF THAT VALUE IN THE PARENT TABLE...IT WORKS FOR ALL VALUES..BUT WHEN I ENTER NULL VALUE ...IT IS GETTING INSERTED INTO THE CHILD TABLE EVEN THOUGH THERE IS NO NULL IN PRIMARY KEY FIELD(WHICH CANNOT CONTAIN NULL) IN PARENT TABLE .."

PLS ANYONE CLEAR MY SMALL DOUBT..

SRINIVAS
 
You are making the mistake of thinking of NULL as a value. It is not. It means "unknown" or "not applicable". The only thing which will determine whether the child table accepts nulls or not is the setting of the null/not-null attribute on the child column itself. There is no foreign key checking of a null value against the parent table.
 
hi,
Thank You very much for providing the clarification.
srinivas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top