select * from A where commit_time between to_char(sysdate,'yyyymmdd')||'000900' and to_char(sysdate,'yyyymmdd')||'001000' or commit_time between to_char(sysdate,'yyyymmdd')||'001500' and to_char(sysdate,'yyyymmdd')||'001600'
应该是这样的吧: select * from A where commit_time between to_char(sysdate,'yyyymmdd') ¦ ¦'090000' and to_char(sysdate,'yyyymmdd') ¦ ¦'100000' or commit_time between to_char(sysdate,'yyyymmdd') ¦ ¦'150000' and to_char(sysdate,'yyyymmdd') ¦ ¦'160000' ??
commit_time like to_char(sysdate,'yyyymmdd')||'09%' or commit_time like to_char(sysdate,'yyyymmdd')||'15%'
select * from test1 where (to_date(commit_time,'yyyy-mm-dd hh24:mi:ss')>(trunc(sysdate)+9/24) and to_date(commit_time,'yyyy-mm-dd hh24:mi:ss')>(trunc(sysdate)+10/24)) or (to_date(commit_time,'yyyy-mm-dd hh24:mi:ss')>(trunc(sysdate)+15/24) and to_date(commit_time,'yyyy-mm-dd hh24:mi:ss')>(trunc(sysdate)+16/24));测试是成功的。
from A
where commit_time between to_char(sysdate,'yyyymmdd')||'000900'
and to_char(sysdate,'yyyymmdd')||'001000'
or commit_time between to_char(sysdate,'yyyymmdd')||'001500'
and to_char(sysdate,'yyyymmdd')||'001600'
select *
from A
where commit_time between to_char(sysdate,'yyyymmdd') ¦ ¦'090000'
and to_char(sysdate,'yyyymmdd') ¦ ¦'100000'
or commit_time between to_char(sysdate,'yyyymmdd') ¦ ¦'150000'
and to_char(sysdate,'yyyymmdd') ¦ ¦'160000'
??
or
commit_time like to_char(sysdate,'yyyymmdd')||'15%'
where (to_date(commit_time,'yyyy-mm-dd hh24:mi:ss')>(trunc(sysdate)+9/24) and
to_date(commit_time,'yyyy-mm-dd hh24:mi:ss')>(trunc(sysdate)+10/24)) or
(to_date(commit_time,'yyyy-mm-dd hh24:mi:ss')>(trunc(sysdate)+15/24) and
to_date(commit_time,'yyyy-mm-dd hh24:mi:ss')>(trunc(sysdate)+16/24));测试是成功的。