PROCEDURE SP_AUTO_HOUR
IS
v_time varchar2(10);
v_time1 varchar2(10);

begin
select to_char(sysdate-1/24,'yyyymmddhh24') into v_time from dual;

select to_char(sysdate,'yyyymmddhh24') into v_time1 from dual;

insert into test select * from test1 where to_char(time,'yyyymmddhh24') between v_time and v_time1;
commit;

end;

你这个完全不用考虑0点的问题,已经计算在内了,到时你可以试试,也可以手动执行一下
追问:
这是我根据你写的改的sql语句,你看看哪里不好帮我改改

select * from table where time between to_date(to_char(sysdate-1/24,'yyyymmddhh24'),'yyyymmddhh24') and to_date(to_char(sysdate,'yyyymmddhh24'),'yyyymmddhh24');
追答:
语法应该没错误,不用改了,你执行一下检查下数据就行