IBM Support

IT07875: WRONG RESULT IN ORA MODE WHEN GENERATED TWIN PRED CONTAINS CHAR WITH HEX VALUES LOWER THEN SPACE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • CREATE TABLE T(c1 CHAR(3))
    INSERT INTO T VALUES('abc');
    SELECT * FROM T WHERE c2 < CAST('abc' || CHR(10) AS
    VARCHAR(10));
    => Returns 'abc' which is correct because in ORA mode we compare
    non padded as VARCHAR
    Now add an index:
    CREATE INDEX I ON T(c1);
    SELECT * FROM T WHERE c2 < CAST('abc' || CHR(10) AS
    VARCHAR(10));
    => NOW ROWS FOUND
    
    The problem is caused by our CHAR padding semantics, when twin
    predicate  is generated we add a CHAR cast function
    
    3) Stop Key Predicate,
       Comparison Operator:   Less Than or Equal (<=)
       Subquery Input Required:  No
       Filter Factor:    0.333333
    
       Predicate Text:
       --------------
       (Q1.C1 <= CHAR(ORA_VARCHAR(('abc' || "SYSFUN "."CHR"(10)))))
    
    what happens is the expression CHAR(ORA_VARCHAR(('abc' ||
    "SYSFUN "."CHR"(10))))  produces hex value 6162630A  a four
    character CHAR string so our semantics tell us
    that we should pad other expression Q1.C1 which has 'abc' with
    empty space 20 , so we getting 61626320 < 6162630A which is
    false. Without index we do not generate twin predicates and
    comparing varchars hence no problem.
    
    Predicate Text:
       --------------
       (ORA_VARCHAR(Q1.C1) < ORA_VARCHAR(('abc' || "SYSFUN
    "."CHR"(10))))
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * ORA compatibility users                                      *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 version 9.7 fix pack 11                       *
    ****************************************************************
    

Problem conclusion

  • First fixed in DB2 version 9.7 fix pack 11
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT07875

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2015-03-23

  • Closed date

    2015-10-06

  • Last modified date

    2015-10-06

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

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

    IT08636 IT08637

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • R970 PSN

       UP

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSEPGG","label":"DB2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.7","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
06 October 2015