x

How to separate coma delimited values

HI,

I am having a string variable. Where the values are delimited. For example: String sample='a,b,c,d,e'

How to split this string into mutiple values and pass it to an arry?

Regards BI DWH BALA

more ▼

asked Nov 26, 2009 at 05:10 PM in Default

BI DWH BALA gravatar image

BI DWH BALA
606 43 60 62

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Hi,

I found a link, where it is explained very well.

Click Here

Regards BI DWH BALA

more ▼

answered Nov 30, 2009 at 01:55 PM

BI DWH BALA gravatar image

BI DWH BALA
606 43 60 62

(comments are locked)
10|1200 characters needed characters left

with strings as (select 'a;b;c;d;e;f' str , ';' sep from dual) select regexp_substr ( str , '[^' || sep || ']+' , 1 , level ) word from strings connect by level <= (length ( str ) - length ( replace ( str , sep ) )) / length ( sep ) + 1;

more ▼

answered Jun 29, 2010 at 04:18 AM

arnaud gravatar image

arnaud
1

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x50

asked: Nov 26, 2009 at 05:10 PM

Seen: 870 times

Last Updated: Nov 26, 2009 at 05:10 PM