网站首页 文章专栏 oracle去重删除
oracle去重删除
编辑时间:2019-09-05 15:23:49.0 作者:hcy 浏览量:197

 

写存储过程删,delete 语句删太慢~

-- Created on 2019-09-05 by ADMINISTRATOR 
declare 
  -- Local variables here
  i integer;
  v_rowid varchar2(30);
begin
  i:=0;
  -- Test statements here
  for r in(
    select rlid from reclist group by rlid having count(1)>1
  ) loop 
     select min(rowid) into v_rowid from reclist where rlid = r.rlid;
     delete from reclist where rlid=r.rlid and rowid <> v_rowid;
  end loop;
end;

来说两句吧
最新评论