Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2012
    Posts
    11

    Unanswered: How to split comma separated varchar input parameter in stored procedure?

    Hi all,

    I am trying to pass varchar as input parameter in my stored procedure. This varchar has comma separated values. For e.g.

    name is my varchar input parameter having values -
    'name1, name2, name3, name4, name5'

    I want to split these values in stored procedure and to retrieve these values in an array. I am using db2 8.2. How to do it?
    As per my knowledge I can't create user-defined array type in db2 8.2. So I am trying to take all values as comma separated in single varchar variable and as input parameter, passing through the stored procedure. Now I want this splitted values in simple varchar array. Please provide me some solution over this.

    I really appreciate your help.
    Last edited by prodigy201; 02-02-12 at 03:11.

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    I won't even bother explaining that this is an FAQ and a little bit of search would turn up, for example: Parsing Strings in SQL
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •