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

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as user error.

Error 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.
    

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')))
    

Problem summary

Problem conclusion

Temporary fix

Comments

  • Fixed the problem
    

APAR Information

  • APAR number

    IC81980

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    950

  • Status

    CLOSED USE

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-03-13

  • Closed date

    2013-03-29

  • Last modified date

    2013-03-29

  • APAR is sysrouted FROM one or more of the following:

    IC81959

  • APAR is sysrouted TO one or more of the following:

    IC84575

Fix information

Applicable component levels



Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

DB2 for Linux, UNIX and Windows

Software version:

9.5

Reference #:

IC81980

Modified date:

2013-03-29

Translate my page

Machine Translation

Content navigation