CREATE OR REPLACE PROCEDURE SP_INTERFACELOG_TO_HISTORY IS
BEGIN
/* declare
CURSOR logs IS
SELECT * FROM thorn_interface_log log WHERE TO_CHAR(log.created_time, ‘yyyyMMdd‘)<=TO_CHAR(SYSDATE-60,‘yyyyMMdd‘);
TYPE his_log IS TABLE OF thorn_interface_log%ROWTYPE;
his_logs his_log;
BEGIN
OPEN logs;
WHILE (TRUE) LOOP
FETCH logs BULK COLLECT
INTO his_logs LIMIT 10000;
FORALL i IN 1 .. his_logs.COUNT
INSERT INTO thorn_interface_log_back VALUES his_logs (i);
COMMIT;
EXIT WHEN logs%NOTFOUND;
END LOOP;
CLOSE logs;
END;*/
DELETE FROM thorn_interface_log log WHERE TO_CHAR(log.created_time, ‘yyyyMMdd‘)<=TO_CHAR(SYSDATE-180,‘yyyyMMdd‘);
COMMIT;
DELETE FROM THORN_TASKS T WHERE TO_CHAR(T.Create_Time,‘yyyyMMdd‘)<=TO_CHAR(SYSDATE-20,‘yyyyMMdd‘);
COMMIT;
DELETE FROM TMS_EDI_TASK T WHERE TO_CHAR(T.Create_Time,‘yyyyMMdd‘)<=TO_CHAR(SYSDATE-20,‘yyyyMMdd‘);
COMMIT;
DELETE FROM TMS_INTERFACE_FROM_LOG T WHERE TO_CHAR(T.Request_Time,‘yyyyMMdd‘)<=TO_CHAR(SYSDATE-180,‘yyyyMMdd‘);
COMMIT;
DELETE FROM TMS_INTERFACE_TO_LOG T WHERE TO_CHAR(T.Request_Time,‘yyyyMMdd‘)<=TO_CHAR(SYSDATE-180,‘yyyyMMdd‘);
COMMIT;
END SP_INTERFACELOG_TO_HISTORY;