create or replace procedure sp_time AS
if to_number(to_char(sysdate,'mi')) -30 > 0 then
v_begintime := trunc(sysdate,'hh24');
v_endtime := trunc(sysdate,'hh24') + 1/48;
else
v_begintime := trunc(sysdate,'hh24') - 1/48;
v_endtime := trunc(sysdate,'hh24');
end if;
dbms_output.put_line('v_begintime:' || to_char(v_begintime,'YYYYMMDD HH24:MI:SS') );
dbms_output.put_line('v_endtime:' || to_char(v_endtime,'YYYYMMDD HH24:MI:SS') );
end;