Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Oracle Miscellaneous > Re: splitting a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 6 Topic 6871 of 7280
Post > Topic >>

Re: splitting a string into columns

by Walt <walt_askier@[EMAIL PROTECTED] > May 2, 2008 at 09:55 AM

kes wrote:
> 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;
> "TABLE1_ID","CSV1","CSV2"
> "1","a,b,c","w,x,y,z"
> "2","a,b,c,d","x,y,z"
> 
> 
> 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.

I'm not sure what you're trying to accomplish here, but did you try the 
concatenation operator ?

Select table1_id||csv1||csv2 from table1;

Generally, I wouldn't store comma separated values in the database, I'd 
store the values individually and concatenate them into a csv list as 
needed.

//Walt
 




 6 Posts in Topic:
splitting a string into columns
kes <abirch@[EMAIL PRO  2008-05-01 16:55:48 
Re: splitting a string into columns
DA Morgan <damorgan@[E  2008-05-01 18:21:34 
Re: splitting a string into columns
Ed Prochak <edprochak@  2008-05-02 05:19:04 
Re: splitting a string into columns
Walt <walt_askier@[EMA  2008-05-02 09:55:46 
Re: splitting a string into columns
kes <abirch@[EMAIL PRO  2008-05-02 08:18:02 
Re: splitting a string into columns
joel garry <joel-garry  2008-05-02 13:28:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 0:19:34 CST 2008.