Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DB2 coalesce function for replacing null date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Sanath sekhar Reddy N

New User


Joined: 31 Oct 2012
Posts: 31
Location: INDIA

PostPosted: Thu Jul 11, 2013 6:11 pm    Post subject: DB2 coalesce function for replacing null date
Reply with quote

Hi

Could you please help me in resolving the below.
I have to replace the null value in date field in the table A
with 00.00.0000 .

Please can any one help me in time.


Regards
Sanath sekhar Reddy.N
Back to top
View user's profile Send private message

Auryn

New User


Joined: 11 Jan 2006
Posts: 40
Location: Lower Saxony (DE)

PostPosted: Thu Jul 11, 2013 6:33 pm    Post subject: Solution depends on type of result column
Reply with quote

If the type of the result column is DATE your desired value is not valid. The minimum valid date in DB2 z/OS is '01.01.0001'.
But if type of result column is CHAR(10) you can use
Code:
COALESCE(CHAR(my_date_col), '00.00.0000')
.
But pay attention of the result a date string containing 'DD.MM.YYYY'. It's better to use the reverse format 'YYYY.MM.DD'.
In above sample
Code:
COALESCE(CHAR(my_date_col), '0000.00.00')


If not every part of the date (or time as well) is known and you would like to store zeroes or spaces in that case you have to use a date string because i.e. date '00.12.2013' is invalid as well.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us