If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Handing NULL values in DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Apr 2003
Location: SC, USA
Posts: 51
Handling NULL values in DB2

I've been asked to weigh in on a design decision that was made here long ago. I'm primarily a SQL Server and Oracle guy so I don't know that much about DB2. All of our DB2 databases have the NOT NULL constraint on every attribute. The DBA who originally designed the physical databases (a contractor who is long gone) told us that DB2 handles NULL values 'differently' than other RDBMSs and therefore you should never have a NULL value in DB2, use an empty string or some other default instead. Just what she meant by 'differently', I'm not sure, but I'm expecting a phone call from her and will ask then.

Personally I find this assertion unbelieveable. Certainly DB2 does handle NULLs in a predictable, standard fashion. Right?

Thanks in advance for your learned opinions!

Last edited by loach; 04-25-03 at 11:57.
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Apr 2003
Location: Florida
Posts: 79
os/390 DB2 handles NULLs just fine....(I'm sure other flavers of DB2 handle NULL as well). Your site may be using Cobol to process data which requires some extra programming to handle NULLs. We use NULL Very little because of the additional Cobol programming, but NULL is appropriate in some cases and has worked in a predictable fashion.
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Apr 2003
Location: SC, USA
Posts: 51
I've done some reasearch on my own and discovered that DB2 does, as you point out, handle NULLS in the ANSI standard fashion.

I've since spoken with the DBA that set this up and we just have a difference of opinion on how to handle NULLs. I prefer to allow them except where business needs dictate that a value is absolutely necessary and then include the additional login in queries to allow for NULL values (for instance, including the OR x IS NULL condition to WHERE clauses that include nullable columns, as appropriate), where she prefers to use artificial NULL values (i.e. empty strings, 0, 1/1/9999, etc) except where the value will be used in aggregate or mathematical functions. We'll just have to agree to disagree, I guess.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On