Skip to Main Content
IBM Power Ideas Portal


This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Future consideration
Workspace IBM i
Categories Db2 for i
Created by Guest
Created on Jun 30, 2022

Extend FINAL TABLE to MERGE statement

DB2 on z/OS offers the FINAL TABLE with the MERGE statement, however on IBM i this is limited to INSERT only.

Please change DB2 for i to also support FINAL TABLE combined with MERGE.

Use case :

in the query below, which increments a counter, MERGE works as a "black box",

and I can't retrieve directly the new value of the counter :

MERGE INTO COUNTERS A

USING

(VALUES (

CAST( 'YYYYY' AS CHAR(5)), CAST( 'ZZZZZZZ' AS CHAR(7))

)) AS B (TYP_COUNTR, KEY_COUNTR )

ON A.TYP_COUNTR = B.TYP_COUNTR AND A.KEY_COUNTR = B.KEY_COUNTR

WHEN MATCHED AND A.VAL_COUNTR >= 999999999 THEN

UPDATE SET A.VAL_COUNTR = 1

WHEN MATCHED AND A.VAL_COUNTR < 999999999 THEN

UPDATE SET A.VAL_COUNTR = A.VAL_COUNTR + 1

WHEN NOT MATCHED THEN

INSERT ( A.TYP_COUNTR, A.KEY_COUNTR, A.VAL_COUNTR )

VALUES ( B.TYP_COUNTR, B.KEY_COUNTR, 1 )

;

I would like to be able to include the MERGE in a SELECT ... FROM FINAL TABLE, like this :

SELECT VAL_COUNTR FROM FINAL TABLE (

MERGE INTO COUNTERS A ...

);

Here is the documentation of the technique on z/OS :

https://www.ibm.com/docs/en/db2-for-zos/12?topic=operation-selecting-values-while-merging-data

This technique would be helpful to all IBM i developers who code in SQL.



Idea priority High
  • Admin
    Sabine Jordan
    Reply
    |
    Sep 23, 2022

    The CEAC has reviewed this requirement and recommends that IBM view this as a HIGH priority requirement that is important to address. Having Final Table has the potential to increase the use of Merge because you can get the visibility of what was done in the Merge statement.

    Background: The COMMON Europe Advisory Council (CEAC) members have a broad range of experience in working with small and medium-sized IBM i customers. CEAC has a crucial role in working with IBM i development to help assess the value and impact of individual RFEs on the broader IBM i community and has therefore reviewed your RFE.

    To find out how CEAC help to shape the future of IBM i, see CEAC @ ibm.biz/BdYSYj and the article "The Five Hottest IBM i RFEs Of The Quarter" at ibm.biz/BdYSZT

    Sabine Jordan + Sara Anrdres – CEAC Program Manager, IBM

  • Guest
    Reply
    |
    Jul 27, 2022
    IBM will use this request as input to planning but no commitment is made or implied. This request will be updated in the future if IBM implements it.
  • Guest
    Reply
    |
    Jul 20, 2022

    just a small addition to the initial request: I just discovered that the RRN() function always returns 1 on the "FROM FINAL TABLE (INSERT...)". Could it be possible to add a RrnParent() function, to retrieve the relative record number of the table impacted by the MERGE command ? This would be very useful for tables from old legacy applications that do not have an auto-increment ID column.

  • Guest
    Reply
    |
    Jul 19, 2022

    The CAAC has reviewed this Idea and recommends that IBM view this as a medium priority requirement that should be addressed. Having Final Table has the potential to increase the use of Merge because you can get the visibility of what was done in the Merge statement.


    Background: The COMMON Americas Advisory Council (CAAC) members have a broad range of experience in working with small and medium-sized IBM i customers. CAAC has a key role in working with IBM i development to help assess the value and impact of individual Ideas on the broader IBM i community, and has therefore reviewed your Idea.


    For more information about CAAC, see www.common.org/caac


    Nancy Uthke-Schmucki - CAAC Program Manager