IBM Support

PH55098: IBM DEVELOPER FOR Z/OS V16.1 - SQL QUERY PRODUCES INCORRECT RESULTS WHEN JOINING TABLES CONTAINING THE SAME COLUMN NAME

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • Joining DB2 tables that contain the same column names produces
    incorrect SQL query results.  Instead of displaying the contents
    from each of the columns with the same name, the results only
    show the data from the last table joined.
    
    Running the following sample query will display B.DESC in both
    the A.DESC column as well as the B.DESC column.
    
    SELECT A.ID, A.DESC,
           B.ID, B.DESC
    FROM TEST.TABLE1 AS A
    LEFT JOIN TEST.TABLE2 B ON A.ID = B.ID
    

Local fix

  • If you qualify the column names the issues does not occur.
    Rewrite the query above and qualify the column names.
    
    SELECT A.ID AS TABLE1_ID, A.DESC AS TABLE1_DESC,
           B.ID AS TABLE2_ID, B.DESC AS TABLE2_DESC
    FROM TEST.TABLE1 AS A
    LEFT JOIN TEST.TABLE2 B ON A.ID = B.ID
    

Problem summary

  • SQL queries containing two or more columns with identical names
    would cause each of those columns to display the same values for
     a row.
    

Problem conclusion

  • Result set columns with identical names will now display their
    individual values correctly.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PH55098

  • Reported component name

    DEV FOR Z/OS

  • Reported component ID

    5724T0700

  • Reported release

    G00

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2023-06-12

  • Closed date

    2023-06-16

  • Last modified date

    2023-06-16

  • 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

    DEV FOR Z/OS

  • Fixed component ID

    5724T0700

Applicable component levels

[{"Business Unit":{"code":"BU029","label":"Software"},"Product":{"code":"SSJK49","label":"IBM Developer for z Systems"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"G00"}]

Document Information

Modified date:
16 June 2023