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

Home -> Community -> Usenet -> c.d.o.misc -> Separate word in a field

Separate word in a field

From: RJ <ridwan.jeena_at_gmail.com>
Date: 8 Dec 2006 00:06:06 -0800
Message-ID: <1165565166.774075.87200@16g2000cwy.googlegroups.com>


Hi All,

I have a table (table1) with 2 columns (ID, keywords) The ID column is the PK (values 1..n), and the keywords column is varchar with words separated with a space. EG:

ID         KEYWORD
----        -----------------

1          CAR VEHICLE
2          CHICKEN FOOD CUISINE
3          HOUSE PROPERTY CONSTRUCTION

I need to separate the words to show like this:

ID         KEYWORD
-----       -----------------

1          CAR
1          VEHICLE
2          CHICKEN
2          FOOD
2          CUISINE

etc..

how can this be done in SQL? I know i can use the UNION command to show each record, but how do I separate each word? I've tried using a combination of Instr and substr but its not showing correctly.

Thanks in advance :) Received on Fri Dec 08 2006 - 02:06:06 CST

Original text of this message

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