What is the purpose of a null indicator variable?

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Paramhans
New Member
Posts: 5
Joined: Tue Jan 27, 2015 11:49 am

What is the purpose of a null indicator variable?

Post 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.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

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

Post 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.
Regards
Nic
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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).
Paramhans
New Member
Posts: 5
Joined: Tue Jan 27, 2015 11:49 am

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

Post 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!
Paramhans
New Member
Posts: 5
Joined: Tue Jan 27, 2015 11:49 am

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

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”