DB2 date column has some null values



IBM's flagship relational database management system

DB2 date column has some null values

Postby sindhu_raghu » Mon Mar 30, 2009 10:49 pm

hi

i have created a table named account (accountno,date,balance) and inserted some values into it.
date column has some null values.

if i use select statement like


SELECT BALANCE,OPENDATE INTO :WS-BAL,:WS-OPENDATE
FROM ACCOUNT WHERE ACCOUNTNO = :WS-ACCOUNTNO

the above code doesnot work for the null values and the above code works fine for non-null values

what is the solution to retreive null values?
sindhu_raghu
 
Posts: 1
Joined: Wed Mar 25, 2009 10:14 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DB2

Postby dick scherrer » Tue Mar 31, 2009 12:48 am

Hello and welcome to the forum,

Suggest you drop the table and re-create it without allowing the null . . .

the above code doesnot work for the null values
Do not post "it didn't work". . . This provides nothing for someone to use to help you. You need to post which error, abend, etc occurred.
what is the solution to retreive null values?
There is no solution - null values do not exist and therefore cannot be retrieved. Whether the column is null can be tested (IS NULL) but there is no associated value - x'0000' is NOT null.

As i first suggested, drop the table and re-create without using nulls. More and more places are getting away from NULL as it is nearly always more trouble than it is worth.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post