oracle 删除数据表中的重复

/* 删除重复的反馈表的数据*/
  procedure PRO_CZW_DEL_DOU_FEEBACK as
  begin
    begin
      for rec in (select row_number() over(
           partition by t.ywlsh  /*指定的重复列*/
           order by t.id desc) as lev, /*指定的重复列的排序*/
                         t.*
                    from T_CZW_YW_FEEDBACK t
                   where exists (select 1
                            from T_CZW_YW_FEEDBACK k
                           where k.ywlsh = t.ywlsh
                           group by k.ywlsh
                          having count(*) > 1)) loop
        if rec.lev = 1 then
          null;
        else
          delete T_CZW_YW_FEEDBACK t where t.id = rec.id;
        end if;
      end loop;
    end;
    commit;
  end PRO_CZW_DEL_DOU_FEEBACK;

oracle 删除数据表中的重复,布布扣,bubuko.com

oracle 删除数据表中的重复

上一篇:mysql备份恢复实验


下一篇:Photoshop将绿色外景人物图片转为淡美的橙红色