Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2007
    Posts
    63

    Unanswered: Retrieving rows having null values in a decimal field

    Hi friends,

    I am trying to retrieve the rows having null values in a field of data type "decimal".

    by ."...where amt_retl = 0.0" and ."...where amt_retl = '' "

    here amt_retl is the field name of data type decimal.

    Both are not working. Please suggest

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    I are missing the basic concept of SQL NULLs. Grab a good book that explains the relational model. This article is also quite good: http://en.wikipedia.org/wiki/Null_(SQL)
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    where amt_retl IS NULL
    where amt_retl IS NOT NULL

    where amt_retl = '' (two sing tick marks) does work in Oracle as a test for NULL, and in fact if you do this and the column is not nullable you will get an error saying you cannot test for null on a not nullable column. Oracle has pretty much butchered the SQL standard.

    As Knut suggested, testing for 0 is not the same as testing for null.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  4. #4
    Join Date
    Apr 2007
    Posts
    63
    Thanks and its working fine

Posting Permissions

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