Oracle 时间查询
发布网友
发布时间:2022-04-22 00:05
我来回答
共2个回答
热心网友
时间:2022-05-05 08:12
select case when to_char(sysdate,'MI') between 30 and 59 then to_char(trunc(sysdate,'HH24')+1/48,'HH24:MI') else to_char(trunc(sysdate,'HH24'),'HH24:MI') end start_time,
case when to_char(sysdate,'MI') between 30 and 59 then to_char(trunc(sysdate,'HH24')+1/24,'HH24:MI') else to_char(trunc(sysdate,'HH24')+1/48,'HH24:MI') end end_time
from al;
热心网友
时间:2022-05-05 09:30
写法有很多种,例如下面的:
方法一:select * from al where time between to_date('2013-04-09 16:30:00','yyyy-mm-dd hh24:mi:ss') and to_date('2013-04-09 17:00:00','yyyy-mm-dd hh24:mi:ss');
方法二:select * from al where to_char(time,'yyyy-mm-dd')='2013-04-09 16:30:00';
方法三:select * from al where trunc(time)=to_date('2013-04-09','yyyy-mm-dd');