IBM Support

IT28028: SELECT-STATEMENT WITH WHERE-CLAUSE, FETCH-CLAUSE AND UPDATE-CLAUSE FAILS WITH SQLCODE -511

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Compiling a select-statement that includes a where-clause,
    fetch-clause and
    update-clause may erroneously return SQLCODE -511.  E.g.:
    
        SELECT C1 FROM T WHERE C2 = 1 LIMIT ? FOR UPDATE WITH RS
        SQL0511N The FOR UPDATE clause is not allowed because the
    table specified by
        the cursor cannot be modified. SQLSTATE=42829
    

Local fix

  • If the fetch-clause specifies LIMIT with a constant value,
    change it to use the alternative syntax FETCH FIRST <constant>
    ROWS ONLY.
    
    If the fetch-clause specifies a parameter marker or host
    variable, and there are no other parameter markers or host
    variables in the select-statement, then create a view using the
    fullselect from the original select-statement, but without the
    fetch-clause and update-clause.  Then replace the original
    select-statement with a select from the new view.  Using the
    example above:
    
        CREATE VIEW V AS ( SELECT C1 FROM T WHERE C2 = 1 );
        SELECT C1 FROM V LIMIT ? FOR UPDATE WITH RS;
    
    Otherwise, there is no local fix.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * SQL statements with FOR UPDATE clause                        *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Db2 version 11.1.4.7                              *
    ****************************************************************
    

Problem conclusion

  • First fixed in Db2 version 11.1.4.7
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT28028

  • 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-02-08

  • Closed date

    2022-04-16

  • Last modified date

    2022-04-16

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

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

    IT38215

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • RB10 PSN

       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