orcale 把日期当做查询条件

根据日期查询范围

精确到天

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'

 

posted @ 2017-09-28 18:47  弓长张&木子李  阅读(478)  评论(0编辑  收藏  举报