If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to split comma separated varchar input parameter in stored procedure?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-02-12, 01:56
prodigy201 prodigy201 is offline
Registered User
 
Join Date: Jan 2012
Posts: 11
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 02:11.
Reply With Quote
  #2 (permalink)  
Old 02-02-12, 03:16
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On