1. 程式人生 > >orcale 把日期當做查詢條件

orcale 把日期當做查詢條件

條件 rom cal sele sel time to_char orcal ble

根據日期查詢範圍

精確到天

select * from table where to_char( time,‘yyyy mm dd ‘ ) <= ‘2000 01 01‘

select * from table where to_char( time,‘yyyy-mm-dd ‘ ) <= ‘2000-01-01‘

select * from table where to_char( time,‘yyyy/mm/dd ‘ ) <= ‘2000/01/01‘

精確到秒

select * from table where to_char( time,‘yyyy mm dd hh24 mi ss‘ ) <= ‘2000 01 01 12 12 12‘

select * from table where to_char( time,‘yyyy-mm-dd hh24-mi-ss‘ ) <= ‘2000-01-01 12-12-12‘

select * from table where to_char( time,‘yyyy/mm/dd hh24:mi:ss‘ ) <= ‘2000/01/01 12:12:12‘

orcale 把日期當做查詢條件