Page 1 of 1

What is the purpose of a null indicator variable?

Posted: Wed Dec 23, 2015 2:49 pm
by Paramhans
Hi,

What is the purpose of a null variable in real world? One of the document says, that when a value is not present it is NULL. What is the meaning of it? Can not a proper value showing what the column or row means will do the same thing for a programmer? Can someone please help inthis.

Re: What is the purpose of a null indicator variable?

Posted: Wed Dec 23, 2015 3:02 pm
by nicc
Null is nothing - not zero, not a space, not anything - NOTHING. If you do not supply a value or default value then the variable has no content as far as you are concerned. Therefore, as there is nothing to test against you need a NULL indicator. As you should have known this from day one of yur SQL training you should have been able to discerne what a NULL indicator varible was. As you would have found from a simle internet search - or better - a search of the IBM manuals.

Re: What is the purpose of a null indicator variable?

Posted: Wed Dec 23, 2015 6:38 pm
by Robert Sample
"Real world" data tends to be messy and incomplete. A NULL indicates the data value is not known (there are many reasons this may happen). For example, if you're putting geneologic or demographic data into a database and there is a column NUMBER_OF_CHILDREN, there is a VAST difference between NULL (that is, the number of children are not known) and zero (that is, the number of children is known and the count is zero).

Re: What is the purpose of a null indicator variable?

Posted: Mon Dec 28, 2015 12:10 pm
by Paramhans
nicc wrote:Null is nothing - not zero, not a space, not anything - NOTHING. If you do not supply a value or default value then the variable has no content as far as you are concerned. Therefore, as there is nothing to test against you need a NULL indicator.
I think I understand what you mean!

Re: What is the purpose of a null indicator variable?

Posted: Mon Dec 28, 2015 12:12 pm
by Paramhans
Robert Sample wrote:"Real world" data tends to be messy and incomplete. A NULL indicates the data value is not known (there are many reasons this may happen). For example, if you're putting geneologic or demographic data into a database and there is a column NUMBER_OF_CHILDREN, there is a VAST difference between NULL (that is, the number of children are not known) and zero (that is, the number of children is known and the count is zero).
Thanks for your example Robert. It helps to understand it better. I'll read more about NULL to get more knowledge about them.