# 清除重复数据(数据量较大时使用,每1000条提交一次)
declarev_cnt number := 0;begin -- v_cnt number := 0; loop DELETE FROM T_MS_INDEX WHERE BIZ_TYPE = 'T_MS_PHYEXA_ASSISTEXA' AND ROWNUM < 1000 AND F_PK IN ( SELECT F_PK FROM ( SELECT F_PK, ID, ROW_NUMBER() OVER(partition by ID order by F_PK) rn FROM T_MS_INDEX WHERE biz_type = 'T_MS_PHYEXA_ASSISTEXA' ) where rn > 1 ); v_cnt := SQL%ROWCOUNT; COMMIT; DBMS_OUTPUT.put_line(v_cnt||'行已删除'); EXIT when v_cnt <= 0; END LOOP; END;