CREATE OR REPLACE PROCEDURE INSERT_test IS
BEGIN
FOR RES IN( select *
from v_test v
where not exists (select t.systemid
from t_test t
where t.time <= sysdate + 1
and t.time >= sysdate - 1
and t.systemid is not null
and t.systemid = v.systemid)
and v.time <= sysdate + 1
and v.time >= sysdate - 1
) LOOP
insert into t_test
(systemid, time, data)
values
(res.systemid, res.time, res.data);
END LOOP;
COMMIT;
END INSERT_test;