Topic
  • 1 reply
  • Latest Post - ‏2013-07-15T15:42:03Z by NickLawrence
bjbbarker
bjbbarker
20 Posts

Pinned topic Convert string of IDs to a result set or insert into a table

‏2013-07-12T18:04:44Z |

I have a string of IDs passed in from an external process as '1,4,8,2,3' to a stored procedure and I need to use these IDs in the SQL.  Is there anyway to use these IDs in the stored procedure without using dynamic sql?  Could a UDTF be built to accept these IDs as a parm and then return a table of the IDs?

  • NickLawrence
    NickLawrence
    69 Posts

    Re: Convert string of IDs to a result set or insert into a table

    ‏2013-07-15T15:42:03Z  

    There's an article on UDTFs that was recently posted to developerWorks.

    http://www.ibm.com/developerworks/ibmi/library/i-power-of-udtf/

     

    Using a table function to break apart the CSV list into individual SQL values that are returned as rows and columns seems reasonable to me.