Home » SQL & PL/SQL » SQL & PL/SQL » multiple values in a single column should be populated as multiple rows (oracle 11g)
multiple values in a single column should be populated as multiple rows [message #614922] Wed, 28 May 2014 14:09 Go to next message
vkanuri
Messages: 20
Registered: August 2013
Location: United States
Junior Member
Hi,
I have first table ud with one of the field attr_value having multiple values '36, 40, 43' in it separated with comma.Now data from table ud should be moved to udf with those multiple values populated into multiple rows.Table should look like follows:
ud
----
ID VALUE DESCR ATTR ATTR_VALUE
2 1 Core 001 37
3 4 Core 005 42
2 2 Update 001 36, 40, 43

Target table udf
-----------------
FID VALUE DESCR ATTR ATTR_VALUE
2 1 Core 001 37
3 4 Core 005 42
2 2 Update 001 36
2 2 Update 001 40
2 2 Update 001 43



create table ud
(
id varchar(20),
value varchar2(20),
descr varchar2(20),
attr varchar2(20),
attr_value varchar2(20));

table UD created.

insert into  ud values(2,1,'Core',001,37);

1 rows inserted.

insert into  ud values(2,2,'Update',001,'36, 40, 43');

1 rows inserted.

create table udf
(fid number,
value number,
descr varchar2(20),
attr number,
attr_value number);

table UDF created.




Can anyone please help with this.

Thanks..
Re: multiple values in a single column should be populated as multiple rows [message #614924 is a reply to message #614922] Wed, 28 May 2014 14:14 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

http://www.orafaq.com/forum/mv/msg/95011/569066/#msg_569066

Previous Topic: re-raising the exception.
Next Topic: View on synonym
Goto Forum:
  


Current Time: Thu Mar 28 18:13:28 CDT 2024