create or replace procedure proc_log_archive is
begin
insert into wibp.ATT_SRV_LOG_OLD
select *
from wibp.ATT_SRV_LOG t
where to_char(t.from_date, 'yyyy-MM-dd') <=
to_char(sysdate - 365, 'yyyy-MM-dd')
and not exists
(select 1 from wibp.ATT_SRV_LOG_OLD where guid = t.guid);
commit;
delete from wibp.ATT_SRV_LOG t
where to_char(t.from_date, 'yyyy-MM-dd') <=
to_char(sysdate - 365, 'yyyy-MM-dd');
commit;
end proc_log_archive;
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/89182.html
標籤:開發
