splitting a string into columns

From: kes <abirch_at_gmail.com>
Date: Thu, 1 May 2008 16:55:48 -0700 (PDT)
Message-ID: <a6d61118-b9b6-4246-9384-3f6dd1dd073d@w74g2000hsh.googlegroups.com>

I'm working with Oracle 10g R2

create table table1(
table1_id number,
csv1 varchar2(100),
csv2 varchar2(100));

insert into table1 values(1, 'a,b,c', 'w,x,y,z'); insert into table1 values(2, 'a,b,c,d', 'x,y,z');

select * from table1;

I would like to see it like
1, a, b, c, , w, x, y, z
2, a, b, c, d, , x, y z

Should I create a store procedure that will split the strings into different rows, then pivot them? Are there any good articles to point to a better way? Any suggestions will be welcomed.

Alex Received on Thu May 01 2008 - 18:55:48 CDT

Original text of this message