Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 Oracle DATE 列,例如,这些值:
RUN_DATE ------------------- 2012-06-09 13:15:00 2012-06-10 14:28:00 2012-06-11 12:20:00 2012-06-12 13:14:00 2012-06-13 11:50:00
我想选择在 13:00 的一个小时内发生的那些值。对于上面的数据,这将是第 1 行、第 3 行和第 4 行。
谢谢
WHERE to_char(run_date, 'HH24:MI' ) between '12:00' and '14:00'
将工作。当然,您可能需要一个基于函数的索引to_char(run_date, 'HH24:MI' )来使其高效运行。
to_char(run_date, 'HH24:MI' )