CREATE OR REPLACE PROCEDURE 自动结转数据
as
begin
insert into test_zjk
select /*+ parallel(8) */ * from test where trunc(TIME,'mm')<trunc(add_months(sysdate,-6),'mm');
insert into test_h
select /*+ parallel(8) */ * from test_zjk where trunc(MSRTIME,'mm')<trunc(add_months(sysdate,-6),'mm');
delete from test a
where exists (select /*+ parallel(8) */ * from test_zjk b where a.id = b.id)
and trunc(a.TIME,'mm')<trunc(add_months(sysdate,-6),'mm');
END;