If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Strange Data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-20-09, 06:24
ratheeshknair ratheeshknair is offline
Registered User
 
Join Date: Jan 2009
Posts: 153
Strange Data

Hi Experts,

I have a timestamp column in which am getting null as result when i query through an application. I dont have direct access to the db and only way is through that appliation. I have checked the length of the column and its showing 4. i hope string null is not allowed in timestamp colum.

Can anyone please tell me is there any particular date to which JAVA responds like this?

TIA
Reply With Quote
  #2 (permalink)  
Old 08-20-09, 08:01
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Timestamp columns should be length 10. I would guess that the column is question is not a Timestamp, but a string where they are putting a time into.

Andy
Reply With Quote
  #3 (permalink)  
Old 08-21-09, 06:49
ratheeshknair ratheeshknair is offline
Registered User
 
Join Date: Jan 2009
Posts: 153
Thansk Andy,

I have checked with the client and the datatype is DATE sorry for putting it as TIMESTAMP.
Reply With Quote
  #4 (permalink)  
Old 08-21-09, 08:01
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Dates in DB2 are indeed length 4. If you are getting null back from this column, then it can be NULL, which means that there is no date value stored there. It is not stored as a string, it is stored as binary. The application should handle null values properly. It is doesn't, then it is a bug that needs to be fixed.

Andy
Reply With Quote
  #5 (permalink)  
Old 08-21-09, 12:49
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Instead of
Quote:
Select ... timestamp_column from The_table
use
Quote:
Select ... coalesce(timestamp_column, CURRENT TIMESTAMP) from The_table
Lenny
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On