Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Break up a field into multiple rows

Break up a field into multiple rows

From: Todd Benson <toddb_at_spectralogic.com>
Date: 25 Oct 2002 16:14:12 -0700
Message-ID: <97b61782.0210251514.7b0e9532@posting.google.com>


I am trying to break down a string into 2 words and return them in separate rows (with the same data in the other fields). So if I have a row with columns A,B,C where C is a string with 2 words (separated by a space), I want a query that will return A,B,C1 and A,B,C2. For example:

create table sales_orders (
 order_number int not null primary key,
 sales_rep varchar(20) not null,
 item varchar(20) not null,
 quantity int not null,
 territories varchar(20) not null
);

insert into table sales_orders values ( 1, 'todd', 'widget', 5, 'east north' );

I am trying to create a query that will return 2 rows:

( 1, 'todd', 'widget', 5, 'east' )

and
( 1, 'todd', 'widget', 5, 'north' )

Any ideas?
Todd Received on Fri Oct 25 2002 - 18:14:12 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US