CONCAT STRINGS [message #371783] |
Tue, 05 December 2000 06:49 |
lhj
Messages: 5 Registered: November 2000
|
Junior Member |
|
|
I need to insert the values(oemno) of table_A concatenated as in table_b, can it be done, I've tried with a pl/sql loop
TABLE_A
itemno oemno
------ -----
11030 1234
11030 23245
11030 88382
12011 12111132
12011 545FR355
10232 45YY47
TABLE_b
itemno oemno
------ -----
11030 1234, 23245, 88382
12011 12111132, 545FR355
10232 45YY47
Best regards
LHJ
|
|
|
Re: CONCAT STRINGS [message #371786 is a reply to message #371783] |
Wed, 06 December 2000 00:32 |
Sudha
Messages: 29 Registered: November 2000
|
Junior Member |
|
|
Hi LHJ,
Try out this
declare
cursor Tab1 is select distinct itemno from Table_A ;
cursor Tab2(num number) is select oemno from Table_A where itemno=num;
V_conval varchar2(1000);
Begin
for i in Tab1 loop
V_conval:='';
for j in tab2(i.Itemno) loop
V_conval:=V_conval||j.oemno||',';
end loop;
V_Conval:=substr(V_conval,1,length(V_conval)-1);
insert into table_b values(i.itemno,v_conval);
end loop;
end;
Sudha
|
|
|