MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

retireving date field from a database

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
kris07
Beginner


Joined: 15 Jan 2007
Posts: 8
Topics: 4
Location: india

PostPosted: Fri Jul 24, 2009 8:34 am    Post subject: retireving date field from a database Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Fri Jul 24, 2009 9:54 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
kris07
Beginner


Joined: 15 Jan 2007
Posts: 8
Topics: 4
Location: india

PostPosted: Mon Aug 03, 2009 3:09 am    Post subject: Reply with quote

Thanks for ur suggestions!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group