home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IC81980 Status: Closed

WRONG RESULTS FROM CONVERTING A TIMESTAMP FIELD TO A STRING TYPE WITH THE
ISO WEEK FORMAT SPECIFICATION 'IW'

product:
DB2 FOR LUW / DB2FORLUW / 950 - DB2
Problem description:
When using the IW option of the format string syntax of 
converting a timestamp to an iso week, a query may incorrectly 
return the iso 
week of 53, when the correct answer should have been 52. 
 
For example: 
db2 values to_char(TIMESTAMP('2011-01-01'),'IW'); 
 
1 
 
----------------------- 
53 
 
 
  1 record(s) selected. 
 
The correct answer here should have been 52. 
 
This incorrect result will only occur if ALL of the following 
conditions are true: 
1. The date being converted is one of the first few days of the 
year such  that these days actually belong to the last ISO week 
of the previous   year. 
 
2. Jan 1st of this year falls on a Saturday. 
 
3. Jan 1st of the previous year is not a Thursday.
Problem Summary:
Local Fix:
Instead of using the IW format string directly, the function 
week_iso() can be used instead, and then convert that answer to 
a char. 
for example: 
db2 values to_char(week_iso(TIMESTAMP('2011-01-01')))
Solution
Workaround
not known / see Local fix
Comment
Fixed the problem
BUG-Tracking
forerunner  : APAR is sysrouted TO one or more of the following: IC84575 
follow-up : 
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
13.03.2012
29.03.2013
29.03.2013
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)
9.5.0.10 FixList