Page 1 of 1

DB2 date column has some null values

PostPosted: Mon Mar 30, 2009 10:49 pm
by sindhu_raghu
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?

Re: DB2

PostPosted: Tue Mar 31, 2009 12:48 am
by dick scherrer
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.