Skip to Main Content
IBM Data and AI Ideas Portal for Customers


This portal is to open public enhancement requests against products and services offered by the IBM Data & AI organization. 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

Post ideas and requests to enhance a product or service. Take a look at ideas others have posted and upvote them if they matter to you,

  1. Post an idea

  2. Upvote ideas that matter most to you

  3. Get feedback from the IBM team to refine your idea


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.

IBM Employees should enter Ideas at https://ideas.ibm.com


Status Not under consideration
Workspace Db2 for z/OS
Created by Guest
Created on Nov 5, 2018

Add a builtin table function that splits a character string

Db2 12 adds the useful LISTAGG function that aggregates a set of string values into a single string.
It would be good to have an inverse: a table function SPLIT that takes a string and a separator, and returns a table of string values.
The signature would be similar to
CREATE FUNCTION SPLIT(str VARCHAR(30000), delim VARCHAR(100))
RETURNS TABLE (
SEQ INTEGER, VALUE VARCHAR(30000)
)

Actually, this function is pretty easy to write as an SQL table function. It would be nicer to have it in the engine, though -- to be symmetrical with LISTAGG.
  • Guest
    Reply
    |
    Feb 26, 2019

    Not only is that function "nice to have" for symmetricity with LISTAGG. Much more importantly, it serves a very concrete purpose: It helps with IN lists of unknown length.

    Suppose we have a search criteria that checks whether a column's value is one of a list of given values, where the length of that list is not known at development time. The statement would look like

    SELECT something FROM table WHERE colval IN (?, ?, ?)

    Since we do not know the number of values, we have to construct the IN list dynamically, trashing the dynamic statement cache since each list length leads to a "new" statement that is not found in the DSC.

    With the SPLIT function, one could write the query as

    SELECT something FROM table WHERE colval IN (SELECT VALUE FROM FUNCTION(SPLIT(?)))

    Where the list of values would be fed into the parameter marker as a single, comma-separated string of values. Alas, only one single statement in the DSC!

    An alternative solution could use temporary tables, but this technique is much easier to implement.