View previous topic :: View next topic |
Author |
Message |
kris07 Beginner
Joined: 15 Jan 2007 Posts: 8 Topics: 4 Location: india
|
Posted: Fri Jul 24, 2009 8:34 am Post subject: retireving date field from a database |
|
|
Hi,
We are retrieving teh date field column and the char filed column thru cursor,since in the table the date field is having no value ,so when we are pulling the data to inrec the output value for the char field is coming with spaces eventhough there is an data
date field is date in db2
char field is char(7).
output both are space.
Pls help how to handle while reading thru cursor to inrec.
Thanks,
krish |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Fri Jul 24, 2009 9:54 am Post subject: |
|
|
Kris07,
I assuming that you are talking about DATE field having NULL values. If that is the case you can use VALUE/COALESCE/IFNULL and populate it with a default value.
ex :
Code: |
SELECT CHAR_COL
,IFNULL(DATE_COL,'0001-01-01')
FROM TABLE
;
|
This will put a default value of '0001-01-01' for date column if it has a null
Learn about the functions VALUE/COALESCE/IFNULL here
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQJ12/3.0?
Kolusu |
|
Back to top |
|
|
kris07 Beginner
Joined: 15 Jan 2007 Posts: 8 Topics: 4 Location: india
|
Posted: Mon Aug 03, 2009 3:09 am Post subject: |
|
|
Thanks for ur suggestions! |
|
Back to top |
|
|
|
|