IBM Support

IT19202: DB2 MAY ISSUE SQL0119N WHEN REFERENCING A CORRELATED COLUMN INSIDE A SCALAR AGGREGATE FUNCTION

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • DB2 may incorrectly issue a SQL0119N when a scalar
    aggregate function references a correlated column. This can
    happen when there are at least two scalar aggregate functions
    with correlated column references.
    
    
    Example:
    
    SELECT
        SUM(case when 99 = (SELECT T1.C2 FROM T1 where T1.C1 =
    T2.C1) then 0 else 1 end),
        SUM(case when 99 = (SELECT T1.C2 FROM T1 where T1.C1 =
    T3.C1) then 0 else 1 end)
    FROM T2, T3
    

Local fix

  • If there is no explicit group by clause, add table references to
    the correlated columns to eliminate correlation within the
    scalar aggregate and also add a DISTINCT to the scalar subquery:
    
    SELECT
        SUM(case when 99 = (SELECT DISTINCT T1.C2 FROM T1, T2 where
    T1.C1 = T2.C1) then 0 else 1 end),
        SUM(case when 99 = (SELECT DISTINCT T1.C2 FROM T1, T3 where
    T1.C1 = T3.C1) then 0 else 1 end)
    FROM T2, T3
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * ALL                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 11.1 Mod 2 Fix Pack 2 or higher               *
    ****************************************************************
    

Problem conclusion

  • First fixed in DB2 11.1 Mod 2 Fix Pack 2
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT19202

  • 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

    2017-02-09

  • Closed date

    2017-06-28

  • Last modified date

    2017-06-28

  • 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

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"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:
29 June 2020