Results 1 to 3 of 3
  1. #1
    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 12:57.

  2. #2
    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.

  3. #3
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •