Oracle用游标删除重复数据

CREATE OR REPLACE 
PROCEDURE PR_MOD_BASE 
IS

cursor c_base IS
SELECT 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;

BEGIN

FOR 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用游标删除重复数据

上一篇:SQL四种语言:DDL,DML,DCL,TCL


下一篇:jQuery 字符串常用方法