首页 > 代码库 > Oracle用游标删除重复数据

Oracle用游标删除重复数据

CREATE OR REPLACE PROCEDURE PR_MOD_BASE IScursor c_base ISSELECT MIN(INVENTORY_DATE) IDATE,KUNNR,MATNR FROM STOCK_BASE_DATA GROUP BY TO_CHAR(INVENTORY_DATE,yyyy-MM-dd),KUNNR,MATNR HAVING count(*) > 1;c_row c_base%rowtype;BEGINFOR c_row in c_base loop        DELETE FROM STOCK_BASE_DATA WHERE INVENTORY_DATE = c_row.IDATE and KUNNR = c_row.KUNNR and MATNR = c_row.MATNR;end loop;COMMIT;END;

 

Oracle用游标删除重复数据