IBM Support

IT30337: INCORRECT RESULTS FOR A QUERY ON COLUMN-ORGANIZED TABLE WHEN FETCH FIRST N ROWS ONLY CALUSE USED

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • CREATE TABLE "MY_SCHEMA"."MY_TABLE" (
    "COL1" VARCHAR(10 CODEUNITS32) NOT NULL,
                "COL2" VARCHAR(600 CODEUNITS32) NOT NULL ,
                "COL3" VARCHAR(10 CODEUNITS32) NOT NULL )
          ORGANIZE BY COLUMN
          DATA CAPTURE NONE
    
    insert into MY_SCHEMA.My_TABLE
    (COL1, COL2, COL3)
    values
      ('a','a','000010'),
      ('a','a','000010'),
      ('b','b','000011'),
      ('c','c','000010'),
      ('c','c','000010'),
      ('d','d','000010'),
      ('d','d','000010'),
      ('d','d','000010');
    
    SELECT DISTINCT
          "COL2" AS "COL2",
          "COL2" AS "COL2_1"
       FROM
          "MY_SCHEMA"."MY_TABLE"  where COL3='000010'
       ORDER BY
             "COL2_1" asc
          FETCH FIRST 3 ROWS ONLY
          FOR FETCH ONLY;
    (return 2 rows, when desc return 1)
    

Local fix

  • As a workaround, the FFNR can be applied after DISTINCT as:
    
    SELECT "COL2", "COL2_1" from
    (SELECT DISTINCT
          "COL2" AS "COL2",
          "COL2" AS "COL2_1"
       FROM
          "MY_SCHEMA"."MY_TABLE"  where COL3='000010
       ORDER BY
             "COL2_1" asc)T
          FETCH FIRST 3 ROWS ONLY
          FOR FETCH ONLY;
    
    The above will work with the regvar setting db2set -im
    DB2COMPOPT=NO_OBELEM
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * All CDE users                                                *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to v111m4fp6                                         *
    ****************************************************************
    

Problem conclusion

  • Fix delivered.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT30337

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2019-09-20

  • Closed date

    2021-03-19

  • Last modified date

    2021-03-19

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

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

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • RB10 PSN

       UP

  • RB10 PSY

       UP

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
03 May 2022