oracle比较两个时间

to_char( date字段, 'HH24:MI:SS' ) between '07:00:00' and '09:30:00'

或者

to_char( date字段, 'HH24:MI:SS' ) >= '07:00:00' 
and to_char( date字段, 'HH24:MI:SS' ) <= '09:30:00'

如果是多个时间段,用or连接

to_char格式

select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') as nowTime from dual;   //日期转化为字符串  
select to_char(sysdate,'yyyy')  as nowYear   from dual;   //获取时间的年  
select to_char(sysdate,'mm')    as nowMonth  from dual;   //获取时间的月  
select to_char(sysdate,'dd')    as nowDay    from dual;   //获取时间的日  
select to_char(sysdate,'hh24')  as nowHour   from dual;   //获取时间的时  
select to_char(sysdate,'mi')    as nowMinute from dual;   //获取时间的分  
select to_char(sysdate,'ss')    as nowSecond from dual;   //获取时间的秒

你可能感兴趣的:(Oracle)