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 > Retrieving rows having null values in a decimal field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-16-08, 16:41
prem18 prem18 is offline
Registered User
 
Join Date: Apr 2007
Posts: 51
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
Reply With Quote
  #2 (permalink)  
Old 10-16-08, 17:01
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #3 (permalink)  
Old 10-16-08, 22:36
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #4 (permalink)  
Old 10-17-08, 13:58
prem18 prem18 is offline
Registered User
 
Join Date: Apr 2007
Posts: 51
Thanks and its working fine
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