Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

general several line with one query

Status
Not open for further replies.

monrow

Technical User
Apr 22, 2008
29
FR
Hi,

I've table with this data


ColA ColB ColC
code1 1 ZE
code2 2 ER:GP
code3 3 SP:NS:LK

I want to obtain this result :


code1 1 ZE
code2 2 ER
code2 2 GP
code3 3 SP
code3 3 NS
code3 3 LK

is-it possible to obtain a result;
how can i built my query ?

thanks for your help
 
I'm sure there is a better way, but to give you something until someone else can provide the way, this will work for the simple example. If you have too many separated values, probably not worth the trouble.

Code:
SELECT ColA, ColB, substr([ColC],1,2) AS Collc
FROM Table1
UNION
SELECT ColA, ColB, substr([ColC],4,2) AS Collc
FROM Table1
UNION
SELECT ColA, ColB, substr([ColC],7,2) AS Collc
FROM Table1

 
thanks sxs but i don't know how many value i have in the ColC : may be 1 or 2 or 3 or 4 or ... or may be no values.
May be i must use a procedure but i don't know how.
Someone can help ???
show the way ???
thanks for your help
 
Monrow,

since your query is more of a general data processing question than a development question, I have posted a response in the oracle 11 forum, which does what you need.

I suggest the general oracle forums may be more useful for you, as I believe they are more frequently answered than this one.

Regards

T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top