17,082
社区成员
发帖
与我相关
我的任务
分享
create or replace procedure test as
cursor carddata is select distinct g from cfsj;
str varchar2(100);
mark number(1);
begin
for x in carddata loop
str :='';
mark:=1;
for y in (select k from cfsj t where t.g = x.g) loop
if mark=1 then
str := y.k;
mark:=2;
end if;
str := str || ',' || y.k;
end loop;
delete from cfsj t1 where rowid !=(select max(rowid) from cfsj t2 where t1.g=t2.g) and t1.g=x.g;
update cfsj set k=str where g=x.g;
end loop;
end;
create table CFSJ
(
a VARCHAR2(1000),
b VARCHAR2(1000),
c VARCHAR2(1000),
d VARCHAR2(1000),
e VARCHAR2(1000),
f VARCHAR2(1000),
g VARCHAR2(1000),
h VARCHAR2(1000),
i VARCHAR2(1000),
j VARCHAR2(1000),
k VARCHAR2(1000),
l VARCHAR2(1000),
m VARCHAR2(1000),
n VARCHAR2(1000)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);