17,086
社区成员
发帖
与我相关
我的任务
分享
delete from event_xx a
where a.rowid>(select min(b.rowid) from event_xx b where b.event_guid =a.event_guid )
and a.event_guid in (select event_guid from event_xx group by event_guid having count(event_guid)>1);
刚才忘加后面的条件了
delete from event_xx a where a.rowid>(select min(b.rowid) from event_xx b where b.event_guid =a.event_guid );
试试这个去重
可以把这个放到 一个表或者临时表
SELECT event_guid,ID FROM (
select ROWID AS ID,event_guid,ROW_NUMBER()OVER(PARTITION BY event_guid ORDER BY 1) AS RN from event_xx )KK
WHERE KK.RN=1
然后做删除处理
declare
cursor my_cur is
select id1 from test2018;
type rec is table of my_cur%rowtype;
recs rec;
begin
open my_cur;
while(ture) loop
fetch my_cur bulk collect into recs limit 100;
forall i in 1 .. recs.count
delete from event_xx where rowid= recs(i);
commit;
end loop;
close my_cur;
end;