/* 刪除重復的反饋表的數據*/ 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;