IBM Support

PI75870: WHEN MIN SCALAR FUNCTION INVOLVES EMPTY STRING, THE SUBSEQUENT ROWS RESULT MIGHT BE WRONG.

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When the MIN scalar function involves an empty string, the
    subsequent rows' result could be wrong.
    For example:
    create table tmp (
    pk int,
    d_vchr VARCHAR(254)    FOR MIXED DATA NOT NULL,
    n_vchr VARCHAR(254)    FOR SBCS DATA
    ) CCSID UNICODE;
    insert into tmp values (1, '','');
    insert into tmp values (2, 'a','a');
    SELECT MIN('32', D_VCHR) FROM TMP;
    returns 2 empty strings incorrectly.
    
    This APAR is a retrofit of DB2 12 APAR PI75077.
    

Local fix

  • n/a
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: All DB2 11 for z/OS users of queries with    *
    *                 MIN/MAX scalar function on varying string    *
    *                 column with empty string data.               *
    ****************************************************************
    * PROBLEM DESCRIPTION: An incorrect result (wrong data         *
    *                      returned) can occur from a              *
    *                      query that contains MIN/MAX scalar      *
    *                      function on varying string column       *
    *                      with empty string data. The subsequent  *
    *                      row result could be wrong.              *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    An incorrect result (wrong data returned) can occur
    from a query that contains MIN/MAX scalar function on varying
    string column with empty string data. The subsequent row
    result could be wrong.
    
    The following example helps to illustrate the failure.
    CREATE TABLE TMP (
                      PK INT,
                      D_VCHR VARCHAR(254) FOR MIXED DATA NOT NULL,
                      N_VCHR VARCHAR(254)    FOR SBCS DATA
                     ) CCSID UNICODE;
    COMMIT;
    
    INSERT INTO TMP VALUES (1, '','');
    INSERT INTO TMP VALUES (2, 'A','A');
    
    SELECT MIN('32', D_VCHR) FROM TMP;
    
    The result of the above query is such that two empty strings are
    returned incorrectly.
      +-------------------+
      |                   |
      +-------------------+
    1_|                   |
    2_|                   |
      +-------------------+
    
    However, the expected result to be returned is an empty string
    and '32'.
    
      +-------------------+
      |                   |
      +-------------------+
    1_|                   |
    2_|32                 |
      +-------------------+
    

Problem conclusion

  • The code in DB2 which processes MIN/MAX scalar function on
    varying string column is modified. This will allow a correct
    result to be returned. Similar code changes are also made for
    fixed length string column.
    
    Additional Keywords: SQLMIN  SQLMAX SQLINCORR SQLINCORROUT
                         INCORROUT
    

Temporary fix

  • *********
    * HIPER *
    *********
    

Comments

APAR Information

  • APAR number

    PI75870

  • Reported component name

    DB2 OS/390 & Z/

  • Reported component ID

    5740XYR00

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    YesHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-02-01

  • Closed date

    2017-02-23

  • Last modified date

    2017-04-03

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

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

    UI44987

Modules/Macros

  • DSNXRCSF DSNXRGBJ DSNXRRSQ DSNXRSFJ DSNXRSFN
    DSNXRSGB DSNXRSJ  DSNXRSOR DSNXRWND
    

Fix information

  • Fixed component name

    DB2 OS/390 & Z/

  • Fixed component ID

    5740XYR00

Applicable component levels

  • RB10 PSY UI44987

       UP17/03/13 P F703 Ž

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEPEK","label":"Db2 for z\/OS"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.0","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
03 April 2017